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


class DocumentTypeDigitization(Base, TenantScopedMixin, TimestampMixin):
    """Tipos de documentos para digitalización de pedimentos"""

    __tablename__ = "document_types_digitization"
    __table_args__ = (
        PrimaryKeyConstraint("id", name="document_types_digitization_pkey"),
        UniqueConstraint(
            "tenant_id",
            "company_id",
            "code",
            name="document_types_digitization_code_key",
        ),
        {"schema": "a76"},
    )

    id: Mapped[int] = mapped_column(Integer)
    code: Mapped[str] = mapped_column(String(10), nullable=False, index=True)
    description: Mapped[str] = mapped_column(Text, nullable=False)
    active: Mapped[bool] = mapped_column(Boolean, default=True, server_default="true")
