"""TTSJobRepository 端口接口 — Phase 3 CosyVoice 集成."""

from __future__ import annotations

from typing import Protocol

from packages.domain.tts_job import TTSJob, TTSJobStatus


class TTSJobRepository(Protocol):
    """TTS 任务仓储接口。"""

    def create(self, job: TTSJob) -> TTSJob:
        """持久化一个新 TTS 任务。"""
        ...

    def get(self, job_id: str) -> TTSJob | None:
        """根据 ID 获取任务。"""
        ...

    def update(self, job: TTSJob) -> TTSJob:
        """更新任务状态。"""
        ...

    def delete(self, job_id: str) -> bool:
        """删除任务。"""
        ...

    def list_by_user(
        self,
        user_id: str,
        *,
        status: TTSJobStatus | str | None = None,
        limit: int = 50,
        offset: int = 0,
    ) -> list[TTSJob]:
        """按用户列出任务，支持状态过滤。"""
        ...

    def count_by_user(
        self,
        user_id: str,
        *,
        status: TTSJobStatus | str | None = None,
    ) -> int:
        """按用户统计任务数量。"""
        ...

    def list_by_profile(
        self,
        voice_clone_profile_id: str,
        *,
        status: TTSJobStatus | str | None = None,
        limit: int = 50,
        offset: int = 0,
    ) -> list[TTSJob]:
        """按音色克隆档案列出任务。"""
        ...
