from core.database import Base
from sqlalchemy import PrimaryKeyConstraint, String
from sqlalchemy.orm import Mapped, mapped_column


class CurrencyType(Base):
    __tablename__ = "currency_types"  # GTiposMoneda
    __table_args__ = (
        PrimaryKeyConstraint("code", name="currency_types_pkey"),
        {"schema": "public", "extend_existing": True},
    )

    code: Mapped[str] = mapped_column(
        String(3), primary_key=True, nullable=False
    )  # código ISO o clave de moneda
    currency_name: Mapped[str] = mapped_column(
        String(15), nullable=False
    )  # nombre de la moneda (por ejemplo: Peso, Dollar)
    country_description: Mapped[str] = mapped_column(
        String(50)
    )  # país asociado o descripción del país

    def __repr__(self):
        return f"<CurrencyType(code={self.code}, currency_name={self.currency_name}, country_description={self.country_description})>"
