from typing import Literal

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 ItemGroup(BaseModel):
    side: Literal["left", "right"]
    picture: PictureAsset
    quantity: PositiveInt


class MoreItemsComparison(BaseModel):
    position: PositiveInt
    left_group: ItemGroup
    right_group: ItemGroup
    answer_side: Literal["left", "right"]
    has_answer_box: bool = True


class WhereAreMoreItemsProblem(BaseModel):
    instructions: str = "Marca dónde hay más."
    comparisons: list[MoreItemsComparison]


class WhereAreMoreItemsRequest(BaseModel):
    available_pictures: list[PictureAsset] = Field(min_length=1)
    comparison_count: PositiveInt = 3
    min_quantity: PositiveInt = 1
    max_quantity: PositiveInt = 10
    seed: int | None = None
