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

from pydantic import BaseModel, ConfigDict


class PedimentoContributionBase(BaseModel):
    """Base schema for Pedimento Contribution"""

    pedimento_id: Optional[int] = None
    contribucion: Optional[str] = None
    tipo_tasa: Optional[str] = None
    tasa: Optional[Decimal] = None
    forma_pago: Optional[str] = None
    importe: Optional[Decimal] = None
    gravamen: Optional[str] = None
    abreviacion: Optional[str] = None
    forma_pago_2: Optional[str] = None
    importe_2: Optional[Decimal] = None


class PedimentoContributionCreate(PedimentoContributionBase):
    """Schema for creating Pedimento Contribution"""

    pass


class PedimentoContributionUpdate(BaseModel):
    """Schema for updating Pedimento Contribution"""

    contribucion: Optional[str] = None
    tipo_tasa: Optional[str] = None
    tasa: Optional[Decimal] = None
    forma_pago: Optional[str] = None
    importe: Optional[Decimal] = None
    gravamen: Optional[str] = None
    abreviacion: Optional[str] = None
    forma_pago_2: Optional[str] = None
    importe_2: Optional[Decimal] = None


class PedimentoContributionResponse(PedimentoContributionBase):
    """Schema for Pedimento Contribution response"""

    id: int
    created_at: datetime

    model_config = ConfigDict(from_attributes=True)
