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


class CustomsWarehouse(Base):
    __tablename__ = "customs_warehouses"  # GRecintos
    __table_args__ = (
        PrimaryKeyConstraint("key", "customs", name="pk_customs_warehouse"),
        {"schema": "public", "extend_existing": True},  # opcional
    )

    key: Mapped[str] = mapped_column(
        String(3), nullable=False)  # clave del recinto
    customs: Mapped[str] = mapped_column(
        String(100), nullable=False)  # aduana asociada
    fiscalized_warehouse: Mapped[str] = mapped_column(
        String(1000)
    )  # recintos fiscalizados (valor legal)

    def __repr__(self):
        return f"<CustomsWarehouse(key={self.key}, customs={self.customs}, fiscalized_warehouse={self.fiscalized_warehouse})>"
