from datetime import datetime
from decimal import Decimal
from typing import Optional

from pydantic import BaseModel, ConfigDict, Field


class PedimentoIndexesBase(BaseModel):
    """Base schema for Pedimento Indexes"""

    pedimento_id: Optional[int] = Field(None, description="Pedimento ID")
    tenant_id: Optional[int] = Field(None, description="Tenant ID")
    update_factor_type: Optional[int] = Field(None, description="Update factor type")
    update_factor: Optional[Decimal] = Field(None, description="Update factor")
    manual_update_factor: Optional[bool] = Field(
        None, description="Manual update factor"
    )


class PedimentoIndexesCreate(PedimentoIndexesBase):
    """Schema for creating a new Pedimento Indexes"""

    pass


class PedimentoIndexesUpdate(BaseModel):
    """Schema for updating a Pedimento Indexes"""

    update_factor_type: Optional[int] = None
    update_factor: Optional[Decimal] = None
    manual_update_factor: Optional[bool] = None


class PedimentoIndexesResponse(PedimentoIndexesBase):
    """Schema for Pedimento Indexes response"""

    id: int
    created_at: datetime

    model_config = ConfigDict(from_attributes=True)
