from typing import Annotated, Literal

from pydantic import BaseModel, Field

MAX_ROWS = 5000


class ParseResult(BaseModel):
    headers: list[str]
    rows: Annotated[list[dict], Field(min_length=1, max_length=MAX_ROWS)]
    column_map: dict


class CommitRequest(BaseModel):
    rows: Annotated[list[dict], Field(min_length=1, max_length=MAX_ROWS)]
    column_map: dict
    mode: Literal["skip", "overwrite"] = "skip"
    pre_mapped: bool = False
    create_missing_taxonomy: bool = False  # True=rows 已是目标字段名的成品(补全后)，不再按 column_map 二次映射
