"""Tax rate schemas — create, update, read, list."""

from __future__ import annotations

from pydantic import BaseModel, Field


class TaxRateCreate(BaseModel):
    name: str = Field(..., min_length=1, max_length=100)
    rate: float = Field(..., ge=0, le=100)
    is_default: bool = False
    country: str | None = Field(None, max_length=2)


class TaxRateUpdate(BaseModel):
    name: str | None = Field(None, min_length=1, max_length=100)
    rate: float | None = Field(None, ge=0, le=100)
    is_default: bool | None = None
    country: str | None = Field(None, max_length=2)


class TaxRateResponse(BaseModel):
    id: str
    name: str
    rate: float
    is_default: bool
    country: str | None = None
    created_at: str | None = None
    updated_at: str | None = None


class TaxRateListResponse(BaseModel):
    items: list[TaxRateResponse]
    total: int
