from datetime import datetime
from typing import Optional

from pydantic import BaseModel, ConfigDict, Field

from api.v1.common.dto_mixins import UpdateFlagsMixin


class PedimentoConfigUpdateRectificationBase(BaseModel, UpdateFlagsMixin):
    """Base schema for Pedimento Config Update Rectification"""

    pedimento_id: Optional[int] = Field(None, description="Pedimento ID")
    tenant_id: Optional[int] = Field(None, description="Tenant ID")   
    calculate_surcharge: Optional[bool] = Field(None, description="Calculate surcharge")


class PedimentoConfigUpdateRectificationCreate(PedimentoConfigUpdateRectificationBase):
    """Schema for creating a new Pedimento Config Update Rectification"""

    pass


class PedimentoConfigUpdateRectificationUpdate(BaseModel, UpdateFlagsMixin):
    """Schema for updating a Pedimento Config Update Rectification"""
   
    calculate_surcharge: Optional[bool] = None


class PedimentoConfigUpdateRectificationResponse(
    PedimentoConfigUpdateRectificationBase
):
    """Schema for Pedimento Config Update Rectification response"""

    id: int
    created_at: datetime

    model_config = ConfigDict(from_attributes=True)
