from decimal import Decimal from typing import Optional from api.v1.common.base_models import TenantScopedMixin, TimestampMixin from core.database import Base from sqlalchemy import ( Index, Integer, Numeric, PrimaryKeyConstraint, String, Text, ) from sqlalchemy.orm import Mapped, mapped_column class Manifest(Base, TenantScopedMixin, TimestampMixin): __tablename__ = "manifests" __table_args__ = ( Index("idx_manifests_manifest_number", "manifest_number"), {"schema": "a76"}, ) id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True) manifest_number: Mapped[str] = mapped_column(String(15), nullable=True) importer_details: Mapped[Optional[str]] = mapped_column(String(60), nullable=True) person_in_charge: Mapped[Optional[str]] = mapped_column(String(60), nullable=True) consigned_to: Mapped[Optional[str]] = mapped_column(String(8), nullable=True) sent_by: Mapped[Optional[str]] = mapped_column(String(8), nullable=True) foreign_exit_port: Mapped[Optional[str]] = mapped_column(String(6), nullable=True) foreign_exit_port_loc: Mapped[Optional[str]] = mapped_column(String(4), nullable=True) destination_port: Mapped[Optional[str]] = mapped_column(String(6), nullable=True) destination_port_loc: Mapped[Optional[str]] = mapped_column(String(4), nullable=True) entry_port: Mapped[Optional[str]] = mapped_column(String(6), nullable=True) entry_port_loc: Mapped[Optional[str]] = mapped_column(String(4), nullable=True) entry_date: Mapped[Optional[int]] = mapped_column(Integer, nullable=True) net_weight: Mapped[Optional[Decimal]] = mapped_column(Numeric(19, 8), nullable=True) gross_weight: Mapped[Optional[Decimal]] = mapped_column(Numeric(19, 8), nullable=True) total_value: Mapped[Optional[Decimal]] = mapped_column(Numeric(19, 8), nullable=True) description: Mapped[Optional[str]] = mapped_column(String(2500), nullable=True) broker_code: Mapped[Optional[str]] = mapped_column(String(5), nullable=True) carrier_code: Mapped[Optional[str]] = mapped_column(String(5), nullable=True) payment_invoice_number: Mapped[Optional[str]] = mapped_column(String(5), nullable=True) seal_number: Mapped[Optional[str]] = mapped_column(String(30), nullable=True) entry_hour: Mapped[Optional[int]] = mapped_column(Integer, nullable=True) hazardous_material: Mapped[Optional[str]] = mapped_column(String(2), nullable=True) transport_mode: Mapped[Optional[str]] = mapped_column(String(2), nullable=True) transport_code: Mapped[Optional[str]] = mapped_column(String(14), nullable=True) trailer_number: Mapped[Optional[str]] = mapped_column(String(20), nullable=True) status: Mapped[Optional[str]] = mapped_column(String(14), nullable=True) status_description: Mapped[Optional[str]] = mapped_column(String(1000), nullable=True) manifest_type: Mapped[Optional[str]] = mapped_column(String(3), nullable=True)