"""
Pydantic models for NFOGuard API
"""
from pydantic import BaseModel
from typing import Optional, Dict, Any, List


class SonarrWebhook(BaseModel):
    """Sonarr webhook payload model"""
    eventType: str
    series: Optional[Dict[str, Any]] = None
    episodes: Optional[list] = []
    episodeFile: Optional[Dict[str, Any]] = None
    isUpgrade: Optional[bool] = False

    class Config:
        extra = "allow"


class RadarrWebhook(BaseModel):
    """Radarr webhook payload model"""
    eventType: str
    movie: Optional[Dict[str, Any]] = None
    movieFile: Optional[Dict[str, Any]] = None
    isUpgrade: Optional[bool] = False
    deletedFiles: Optional[list] = []
    remoteMovie: Optional[Dict[str, Any]] = None
    renamedMovieFiles: Optional[List[Dict[str, Any]]] = None

    class Config:
        extra = "allow"


class HealthResponse(BaseModel):
    """Health check response model"""
    status: str
    version: str
    uptime: str
    database_status: str
    radarr_database: Optional[Dict[str, Any]] = None


class TVSeasonRequest(BaseModel):
    """TV season processing request model"""
    series_path: str
    season_name: str


class TVEpisodeRequest(BaseModel):
    """TV episode processing request model"""
    series_path: str
    season_name: str
    episode_name: str