from __future__ import annotations

from pydantic import BaseModel, ConfigDict, Field


class CarrinhoBase(BaseModel):
    itens: list[str] = Field(default_factory=list)
    codigoInterno: str | None = Field(default=None, min_length=1, max_length=255)
    labNome: list[str] = Field(default_factory=list)
    quantidade: list[int] = Field(default_factory=list)
    valorTotal: list[float] = Field(default_factory=list)
    usuarios: str | None = Field(default=None, min_length=1, max_length=255)


class CarrinhoCreate(CarrinhoBase):
    pass


class CarrinhoCreateRequest(BaseModel):
    documentId: str | None = Field(default=None, min_length=1, max_length=255)
    data: CarrinhoCreate


class CarrinhoUpdate(BaseModel):
    itens: list[str] | None = None
    codigoInterno: str | None = Field(default=None, min_length=1, max_length=255)
    labNome: list[str] | None = None
    quantidade: list[int] | None = None
    valorTotal: list[float] | None = None
    usuarios: str | None = Field(default=None, min_length=1, max_length=255)


class CarrinhoUpdateRequest(BaseModel):
    data: CarrinhoUpdate


class CarrinhoOut(BaseModel):
    id: str
    itens: list[str]
    codigoInterno: str | None
    labNome: list[str]
    quantidade: list[int]
    valorTotal: list[float]
    usuarios: str | None
    createdAt: str
    updatedAt: str

    model_config = ConfigDict(from_attributes=True)
