from pydantic import BaseModel, Field, PositiveInt


class AdditionExpression(BaseModel):
    position: PositiveInt
    first_addend: PositiveInt
    second_addend: PositiveInt
    total: PositiveInt
    match_id: str = Field(min_length=1)


class SumConnection(BaseModel):
    match_id: str = Field(min_length=1)
    total: PositiveInt
    left_position: PositiveInt
    right_position: PositiveInt


class JoinCorrespondingSumsProblem(BaseModel):
    instructions: str = "Conecta."
    left_expressions: list[AdditionExpression]
    right_expressions: list[AdditionExpression]
    answer_key: list[SumConnection]


class JoinCorrespondingSumsRequest(BaseModel):
    pair_count: PositiveInt = 3
    min_sum: PositiveInt = 2
    max_sum: PositiveInt = 10
    min_addend: PositiveInt = 1
    max_addend: PositiveInt = 9
    seed: int | None = None
