from typing import Optional

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


class ManifestAnexo(Base, TenantScopedMixin, TimestampMixin):
    __tablename__ = "manifest_anexos"
    __table_args__ = (
        PrimaryKeyConstraint("consecutive", "line_number", name="manifest_anexos_pkey"),
        Index("idx_manifest_anexos_consecutive", "consecutive"),
        {"schema": "a76"},
    )

    consecutive: Mapped[int] = mapped_column(Integer)
    line_number: Mapped[int] = mapped_column(Integer)
    attachment_type: Mapped[Optional[str]] = mapped_column(String(10), nullable=True)
    number: Mapped[Optional[str]] = mapped_column(String(10), nullable=True)
    attached_doc: Mapped[Optional[str]] = mapped_column(String(200), nullable=True)
