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

from __future__ import annotations

from typing import Dict, List, Protocol

from packages.domain.voice_clone_profile import VoiceCloneProfile, VoiceCloneStatus


class VoiceCloneProfileRepository(Protocol):
    """音色克隆档案仓储接口。"""

    def create(self, profile: VoiceCloneProfile) -> VoiceCloneProfile:
        """持久化一个新音色克隆档案。"""
        ...

    def get(self, profile_id: str) -> VoiceCloneProfile | None:
        """根据 ID 获取档案。"""
        ...

    def update(self, profile: VoiceCloneProfile) -> VoiceCloneProfile:
        """更新档案状态。"""
        ...

    def delete(self, profile_id: str) -> bool:
        """删除档案。"""
        ...

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

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

    def find_by_voice_id(self, voice_id: str) -> VoiceCloneProfile | None:
        """根据 CosyVoice 返回的音色 ID 查找档案。"""
        ...

    def find_profile_ids_by_voice_ids(self, voice_ids: List[str]) -> Dict[str, str]:
        """批量查询 voice_id → profile_id 映射。"""
        ...
