"""
封面背景图模型
================

按脚本大类（script_code）分组存储封面背景图。

示例：
- script_code="bk"（装修避坑）→ 该大类下的所有封面背景图
"""

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

from app.models.base import BaseModelBigInt


class CoverBackground(BaseModelBigInt):
    """封面背景图"""

    __tablename__ = "mjk_cover_backgrounds"

    script_code: Mapped[str] = mapped_column(
        String(64),
        nullable=False,
        comment="关联脚本大类 code，如 bk（装修避坑）",
    )

    title: Mapped[str] = mapped_column(
        String(256),
        nullable=False,
        comment="背景图名称，运营识别用",
    )

    url: Mapped[str] = mapped_column(
        String(1024),
        nullable=False,
        comment="七牛云 CDN 图片地址",
    )

    sort_order: Mapped[int] = mapped_column(
        BigInteger,
        default=0,
        nullable=False,
        comment="排序权重，数字越小越靠前",
    )

    status: Mapped[str] = mapped_column(
        String(16),
        default="active",
        nullable=False,
        comment="状态：active（启用）/ disabled（停用）/ deleted（软删除）",
    )
