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 AddendGroup(BaseModel):
    quantity: PositiveInt
    description: str = Field(min_length=1)


class FigureGroup(BaseModel):
    quantity: PositiveInt
    description: str = Field(min_length=1)
    picture: PictureAsset


class ImageOption(BaseModel):
    position: PositiveInt
    quantity: PositiveInt
    first_group: FigureGroup
    second_group: FigureGroup
    is_correct: bool
    has_answer_box: bool = True


class SumWithImageReferenceProblem(BaseModel):
    question: str
    instructions: str = "Escoge la imagen en la próxima página."
    first_group: AddendGroup
    second_group: AddendGroup
    common_object: str = Field(min_length=1)
    total: PositiveInt
    options: list[ImageOption]


class SumWithImageReferenceRequest(BaseModel):
    first_quantity: PositiveInt
    second_quantity: PositiveInt
    first_description: str = Field(min_length=1)
    second_description: str = Field(min_length=1)
    common_object: str = Field(min_length=1)
    first_picture: PictureAsset
    second_picture: PictureAsset
    option_count: PositiveInt = 3
    min_option_quantity: PositiveInt = 1
    max_option_quantity: PositiveInt = 20
    seed: int | None = None
