"""
DTOs for Customs Broker Concepts.
"""

from datetime import datetime
from typing import Optional

from pydantic import BaseModel, Field, ConfigDict


class CustomsBrokerConceptBase(BaseModel):
    broker_key: str = Field(..., max_length=5, description="Customs Broker Key (CLAVEAA)")
    concept: str = Field(..., max_length=15, description="Concept/Code")
    amount: Optional[float] = Field(None, description="Amount (IMPORTE)")
    priority: Optional[int] = Field(None, description="Priority (PRIORIDAD)")


class CustomsBrokerConceptCreate(CustomsBrokerConceptBase):
    """Schema for creating a concept"""
    pass


class CustomsBrokerConceptUpdate(BaseModel):
    """Schema for updating a concept"""
    broker_key: Optional[str] = Field(None, max_length=5, description="Customs Broker Key (CLAVEAA)")
    concept: Optional[str] = Field(None, max_length=15, description="Concept/Code")
    amount: Optional[float] = Field(None, description="Amount (IMPORTE)")
    priority: Optional[int] = Field(None, description="Priority (PRIORIDAD)")


class CustomsBrokerConceptResponse(CustomsBrokerConceptBase):
    """Schema for concept response"""
    id: int
    company_id: int
    tenant_id: int
    created_at: Optional[datetime] = None
    updated_at: Optional[datetime] = None

    model_config = ConfigDict(from_attributes=True)

