from typing import Optional, TYPE_CHECKING from sqlalchemy import Boolean, String, Text, ForeignKey from sqlalchemy.orm import Mapped, mapped_column, relationship from core.database import Base if TYPE_CHECKING: from ..line_items.models import LineItem class LineDescription(Base): """ Description details for line items Consolidates all line-level data from Q and S tables """ __tablename__ = "line_descriptions" __table_args__ = { "schema": "a76", } id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True) item_line_id: Mapped[int] = mapped_column(ForeignKey("a76.item_lines.id")) # Descriptions description_spanish: Mapped[Optional[str]] = mapped_column(String(4999)) # DESCRIPCIONE description_english: Mapped[Optional[str]] = mapped_column(String(4999)) # DESCRIPCIONI extra_description: Mapped[Optional[str]] = mapped_column(Text) # DESCRIPCIONEEXTRA part_description: Mapped[Optional[str]] = mapped_column(String(500)) # DESCRIPCIONPARTE class_description: Mapped[Optional[str]] = mapped_column(String(500)) # DESCRIPCIONCLASE # Product attributes brand: Mapped[Optional[str]] = mapped_column(String(50)) # MARCA model: Mapped[Optional[str]] = mapped_column(String(50)) # MODELO has_serial: Mapped[Optional[bool]] = mapped_column(Boolean) # LLEVASERIE # Additional information additional_info_spanish: Mapped[Optional[str]] = mapped_column(String(1000)) # INFOADICIONESP additional_info_english: Mapped[Optional[str]] = mapped_column(String(1000)) # INFOADICIONING # Lot and entry tracking lot: Mapped[Optional[str]] = mapped_column(String(254)) # LOTE entry_number: Mapped[Optional[str]] = mapped_column(String(50)) # NUMENTRADA/NUMERODEENTRADA # Relationship (one-to-one) line: Mapped["LineItem"] = relationship(back_populates="description")