from datetime import datetime
from typing import Optional

from pydantic import BaseModel, ConfigDict, Field


class PedimentoCustomsOfficesBase(BaseModel):
    """Base schema for Pedimento Customs Offices"""

    pedimento_id: Optional[int] = Field(None, description="Pedimento ID")
    tenant_id: Optional[int] = Field(None, description="Tenant ID")
    dispatch_customs: Optional[str] = Field(
        None, max_length=3, description="Dispatch customs"
    )
    entry_exit_customs: Optional[str] = Field(
        None, max_length=3, description="Entry/exit customs"
    )


class PedimentoCustomsOfficesCreate(PedimentoCustomsOfficesBase):
    """Schema for creating a new Pedimento Customs Offices"""

    pass


class PedimentoCustomsOfficesUpdate(BaseModel):
    """Schema for updating a Pedimento Customs Offices"""

    dispatch_customs: Optional[str] = Field(None, max_length=3)
    entry_exit_customs: Optional[str] = Field(None, max_length=3)


class PedimentoCustomsOfficesResponse(PedimentoCustomsOfficesBase):
    """Schema for Pedimento Customs Offices response"""

    id: int
    created_at: datetime

    model_config = ConfigDict(from_attributes=True)
