"""Esquemas del timbrado de CFDI."""

from datetime import datetime

from pydantic import BaseModel, ConfigDict


class InvoiceStampResponse(BaseModel):
    """Resultado de un timbrado.

    No expone el XML completo: se descarga por URL firmada desde ``/stamp/xml-url``.
    """

    model_config = ConfigDict(from_attributes=True)

    id: int
    invoice_id: int
    mode: str  # pruebas | produccion
    status: str  # pendiente | timbrado | error
    uuid: str | None = None
    stamped_at: datetime | None = None
    pac_rfc: str | None = None
    sat_cert_number: str | None = None
    pac_code: int | None = None
    pac_balance: int | None = None
    error_message: str | None = None
    xml_file_key: str | None = None
    # Rastro del intento: se descargan por URL firmada desde ``/stamp/attempts/{id}/xml-url``.
    request_xml_file_key: str | None = None
    response_xml_file_key: str | None = None
    created_at: datetime | None = None
