from typing import Optional

from pydantic import BaseModel, ConfigDict, Field


class PedimentoRectificationDestinationBase(BaseModel):
    """Base schema for Pedimento Rectification Destination"""

    pedimento_id: Optional[int] = Field(None, description="Pedimento ID")
    tenant_id: Optional[int] = Field(None, description="Tenant ID")
    destination_pedimento_year: Optional[str] = Field(
        None, max_length=2, description="Destination pedimento year"
    )
    destination_customs_office: Optional[str] = Field(
        None, max_length=3, description="Destination customs office"
    )
    destination_license: Optional[str] = Field(
        None, max_length=4, description="Destination license"
    )
    destination_pedimento_number: Optional[str] = Field(
        None, max_length=7, description="Destination pedimento number"
    )


class PedimentoRectificationDestinationCreate(PedimentoRectificationDestinationBase):
    """Schema for creating a new Pedimento Rectification Destination"""

    pass


class PedimentoRectificationDestinationUpdate(BaseModel):
    """Schema for updating a Pedimento Rectification Destination"""

    destination_pedimento_year: Optional[str] = Field(None, max_length=2)
    destination_customs_office: Optional[str] = Field(None, max_length=3)
    destination_license: Optional[str] = Field(None, max_length=4)
    destination_pedimento_number: Optional[str] = Field(None, max_length=7)


class PedimentoRectificationDestinationResponse(PedimentoRectificationDestinationBase):
    """Schema for Pedimento Rectification Destination response"""

    id: int

    model_config = ConfigDict(from_attributes=True)
