from sqladmin import ModelView

from app.lyric.models import Lyric


class LyricAdmin(ModelView, model=Lyric):
    name = "가사"
    name_plural = "가사 목록"
    icon = "fa-solid fa-music"
    category = "가사 관리"
    page_size = 20

    column_list = [
        "id",
        "project_id",
        "task_id",
        "status",
        "language",
        "created_at",
    ]

    column_details_list = [
        "id",
        "project_id",
        "task_id",
        "status",
        "language",
        "lyric_prompt",
        "lyric_result",
        "created_at",
    ]

    # 폼(생성/수정)에서 제외
    form_excluded_columns = ["created_at", "songs", "videos"]

    column_searchable_list = [
        Lyric.task_id,
        Lyric.status,
        Lyric.language,
    ]

    column_default_sort = (Lyric.created_at, True)  # True: DESC (최신순)

    column_sortable_list = [
        Lyric.id,
        Lyric.project_id,
        Lyric.status,
        Lyric.language,
        Lyric.created_at,
    ]

    column_labels = {
        "id": "ID",
        "project_id": "프로젝트 ID",
        "task_id": "작업 ID",
        "status": "상태",
        "language": "언어",
        "lyric_prompt": "프롬프트",
        "lyric_result": "생성 결과",
        "created_at": "생성일시",
    }
