"""Govdoc 报告产物模型 —— govdoc_report_artifacts 表。"""

from __future__ import annotations

from sqlalchemy import BigInteger, String
from sqlalchemy.orm import Mapped, mapped_column

from fastapi_common.fastapi_common_web.models import BaseModel


class GovdocReportArtifact(BaseModel):
    """公文审查报告产物索引表。"""

    __tablename__ = "govdoc_report_artifacts"

    Id: Mapped[int] = mapped_column("id", BigInteger, primary_key=True, autoincrement=True)
    runId: Mapped[int] = mapped_column("run_id", BigInteger, comment="关联 govdoc_runs.id")

    artifactType: Mapped[str] = mapped_column("artifact_type", String(64), comment="产物类型：html_report/annotated_docx/paragraph_html/json_report/original")
    fileName: Mapped[str] = mapped_column("file_name", String(512), comment="文件名")
    fileExt: Mapped[str | None] = mapped_column("file_ext", String(32), comment="扩展名")
    mimeType: Mapped[str | None] = mapped_column("mime_type", String(128), comment="MIME 类型")
    fileSize: Mapped[int | None] = mapped_column("file_size", BigInteger, comment="文件大小（字节）")
    sha256: Mapped[str | None] = mapped_column("sha256", String(64), comment="文件 SHA256")
    ossUrl: Mapped[str | None] = mapped_column("oss_url", String(2048), comment="OSS 访问地址")
    storageProvider: Mapped[str | None] = mapped_column("storage_provider", String(32), comment="存储提供商：oss/minio/local")
    description: Mapped[str | None] = mapped_column("description", String(512), comment="产物说明")
