"""
背景音乐 Schema
==============
"""

from pydantic import BaseModel, Field


class BgmMusicItem(BaseModel):
    """背景音乐项"""

    id: int = Field(description="音乐ID")
    title: str = Field(description="音乐名称")
    artist: str | None = Field(default=None, description="艺术家")
    category: str = Field(description="场景分类")
    file_path: str = Field(description="相对文件路径")
    url: str = Field(description="七牛云 URL")
    duration: float | None = Field(default=None, description="时长（秒）")
    sort_order: int = Field(default=0, description="排序权重")

    class Config:
        from_attributes = True


class BgmMusicListResponse(BaseModel):
    """背景音乐列表响应"""

    items: list[BgmMusicItem] = Field(description="音乐列表")
    total: int = Field(description="总数")
