"""
Processing-related schemas.
"""

from datetime import datetime

from pydantic import BaseModel, Field


class ProcessingRequest(BaseModel):
    """Schema for processing request."""

    user_id: int = Field(..., description="User ID")
    interview_id: int = Field(..., description="Interview ID")
    question_id: int = Field(..., description="Question ID")
    interview_type: str = Field(..., description="Interview type")
    file_path: str = Field(..., description="Path to the file to process")


class ProcessingResult(BaseModel):
    """Schema for processing result."""

    job_id: str
    message: str
    status: str
    filename: str | None = None
    created_at: datetime = Field(default_factory=datetime.utcnow)

    class Config:
        from_attributes = True


class ProcessingStatus(BaseModel):
    """Schema for processing status."""

    job_id: str
    status: str
    progress: int | None = Field(
        None, ge=0, le=100, description="Processing progress percentage"
    )
    current_step: str | None = None
    estimated_completion: datetime | None = None
    error_message: str | None = None
    created_at: datetime

    class Config:
        from_attributes = True


class AIAnalysisResult(BaseModel):
    """AI analysis results."""

    job_id: str
    user_id: int
    interview_id: int
    question_id: int
    interview_type: str

    # Audio analysis
    audio_length: str | None = None
    audio_volume_dbfs: float | None = Field(None, alias="audio_volume_dBFS")
    total_words_spoken: int | None = None
    pace_of_speech: float | None = None
    pause_count: int | None = None

    # Video analysis
    total_video_frames: int | None = None
    eye_contact_center: int | None = None
    eye_contact_left: int | None = None
    eye_contact_right: int | None = None
    smiling_frames: int | None = None

    # Word analysis
    filler_word_count: int | None = None
    power_word_count: int | None = None
    negative_word_count: int | None = None
    um_word_count: int | None = None

    # Transcription
    video_cc: str | None = None

    # Metadata
    processing_duration: str | None = None
    created_at: datetime

    class Config:
        from_attributes = True
