from __future__ import annotations

from typing import Literal

from pydantic import BaseModel, ConfigDict, Field


class PagamentoBase(BaseModel):
    status: Literal["pendente", "pago", "falhou"]
    metodo: str = Field(min_length=1, max_length=255)
    valor: float | None = Field(default=None, ge=0)
    pedidos: str | None = Field(default=None, min_length=1, max_length=255)


class PagamentoCreate(PagamentoBase):
    pass


class PagamentoUpdate(BaseModel):
    status: Literal["pendente", "pago", "falhou"] | None = None
    metodo: str | None = Field(default=None, min_length=1, max_length=255)
    valor: float | None = Field(default=None, ge=0)
    pedidos: str | None = Field(default=None, min_length=1, max_length=255)


class PagamentoOut(BaseModel):
    id: str
    status: Literal["pendente", "pago", "falhou"]
    metodo: str
    valor: float | None
    pedidos: str | None
    createdAt: str
    updatedAt: str

    model_config = ConfigDict(from_attributes=True)
