"""Pydantic schemas for CSV import preview/confirm flow."""

from datetime import date
from typing import Optional

from pydantic import BaseModel


class ImportRow(BaseModel):
    """Single row in import preview."""

    row_number: int
    nachname: str
    vorname: Optional[str] = None
    geburtsdatum: Optional[date] = None
    kvnr: Optional[str] = None
    fallgruppe: str
    datum: date
    is_duplicate: bool = False
    fall_id: Optional[str] = None


class ImportPreview(BaseModel):
    """Preview of CSV import before confirmation."""

    filename: str
    total_rows: int
    new_cases: int
    duplicates: int
    errors: list[str] = []
    rows: list[ImportRow] = []


class ImportResult(BaseModel):
    """Result after confirming import."""

    imported: int
    skipped: int
    updated: int
    errors: list[str] = []
