from api.v1.common.base_models import TenantScopedMixin, TimestampMixin
from core.database import Base
from sqlalchemy import ForeignKeyConstraint, Integer, PrimaryKeyConstraint, String
from sqlalchemy.orm import Mapped, mapped_column


class SClasses(Base, TenantScopedMixin, TimestampMixin):
    __tablename__ = "inv_classes"  # SClases
    __table_args__ = (
        ForeignKeyConstraint(
            ["class_id"], ["a76.classes.id"], name="fk_sclasses_classes"
        ),
        PrimaryKeyConstraint("id", name="sclases_pk"),
        {"schema": "a24"},
    )
    id: Mapped[int] = mapped_column(Integer, primary_key=True)
    class_id: Mapped[int] = mapped_column(Integer, nullable=False)  # Id de clase

    stock_um: Mapped[str] = mapped_column(String(5))  # Unidad de medida para existencia
    us_tariff_code: Mapped[str] = mapped_column(String(19))  # Fracción americana (USA)
