"""Voice library Pydantic schemas."""

from __future__ import annotations

from datetime import datetime
from typing import List, Optional

from pydantic import BaseModel, Field


class VoiceLibraryItemResponse(BaseModel):
    id: str
    user_id: str
    name: str
    text: str = ""
    voice_provider: str = ""
    voice_id: str = ""
    voice_name: str = ""
    audio_url: str = ""
    duration: float = 0
    file_size: int = 0
    status: str = "completed"
    project_id: Optional[str] = None
    tags: List[str] = Field(default_factory=list)
    created_at: datetime
    updated_at: datetime


class ListVoiceLibraryResponse(BaseModel):
    items: list[VoiceLibraryItemResponse]
    total: int = 0


class CreateVoiceLibraryRequest(BaseModel):
    name: str = Field(..., min_length=1, max_length=255)
    text: str = ""
    voice_provider: str = ""
    voice_id: str = ""
    voice_name: str = ""
    audio_url: str = ""
    duration: float = 0
    file_size: int = 0
    status: str = "completed"
    project_id: Optional[str] = None
    tags: List[str] = Field(default_factory=list)


class UpdateVoiceLibraryRequest(BaseModel):
    name: Optional[str] = Field(None, min_length=1, max_length=255)
    text: Optional[str] = None
    voice_provider: Optional[str] = None
    voice_id: Optional[str] = None
    voice_name: Optional[str] = None
    audio_url: Optional[str] = None
    duration: Optional[float] = None
    file_size: Optional[int] = None
    status: Optional[str] = None
    tags: Optional[List[str]] = None
