from pydantic import BaseModel, Field, PositiveInt


class PictureAsset(BaseModel):
    id: str = Field(min_length=1)
    name: str = Field(min_length=1)
    image_path: str = Field(min_length=1)


class DecompositionRow(BaseModel):
    position: PositiveInt
    whole: PositiveInt
    first_part: PositiveInt
    second_part: PositiveInt
    picture: PictureAsset
    has_answer_boxes: bool = True


class ComposeAndDecomposeNumbersProblem(BaseModel):
    instructions: str = "Compón y descompón el número."
    whole: PositiveInt
    picture: PictureAsset
    rows: list[DecompositionRow]


class ComposeAndDecomposeNumbersRequest(BaseModel):
    picture: PictureAsset
    whole: PositiveInt = 10
    randomize_rows: bool = False
    seed: int | None = None
