# generated by datamodel-codegen:
#   filename:  storyboard-schema.json
#   timestamp: 2026-03-18T06:34:40+00:00

from __future__ import annotations

from enum import StrEnum

from pydantic import BaseModel, ConfigDict, Field, confloat, conint


class Voices(StrEnum):
    female = 'female'
    male = 'male'


class ScreenActionType(StrEnum):
    highlight = 'highlight'
    navigate = 'navigate'
    input = 'input'
    scroll = 'scroll'
    wait = 'wait'
    animate = 'animate'
    title = 'title'


class ScreenActionTiming(StrEnum):
    casted = 'casted'
    elastic = 'elastic'
    timed = 'timed'


class ScreenAction(BaseModel):
    model_config = ConfigDict(
        extra='forbid',
        populate_by_name=True,
    )
    type: ScreenActionType
    screen_action_id: conint(ge=0) = Field(..., alias='screenActionId')
    description: str | None = None
    timing: ScreenActionTiming | None = None
    duration_ms: conint(ge=0) | None = Field(
        None, alias='durationMs', description="Required when timing is 'timed'"
    )


class Narration(BaseModel):
    model_config = ConfigDict(
        extra='forbid',
        populate_by_name=True,
    )
    narration_id: conint(ge=0) = Field(..., alias='narrationId')
    text: str | None = None
    voice: str | None = None
    translations: dict[str, str] | None = Field(
        None, description='Translations keyed by language code'
    )
    screen_actions: list[ScreenAction] | None = Field(None, alias='screenActions')
    video_file: str | None = Field(
        None,
        alias='videoFile',
        description='Relative path to the per-narration video file (CDP recording mode)',
    )


class HighlightStyle(BaseModel):
    model_config = ConfigDict(
        extra='forbid',
        populate_by_name=True,
    )
    color: str | None = Field(
        None, description="CSS color for the highlight stroke (e.g. '#ff0000')"
    )
    animation_speed_ms: conint(ge=0) | None = Field(
        None,
        alias='animationSpeedMs',
        description='Duration of the draw animation in milliseconds',
    )
    draw_duration_ms: conint(ge=0) | None = Field(
        None,
        alias='drawDurationMs',
        description='How long the highlight stays visible after drawing',
    )
    opacity: confloat(ge=0.0, le=1.0) | None = Field(
        None, description='Opacity of the highlight stroke'
    )
    padding: conint(ge=0) | None = Field(
        None, description='Padding around the element bounding box'
    )
    scroll_wait_ms: conint(ge=0) | None = Field(
        None,
        alias='scrollWaitMs',
        description='Time to wait after scrolling the element into view',
    )
    remove_wait_ms: conint(ge=0) | None = Field(
        None,
        alias='removeWaitMs',
        description='Time to wait after removing the highlight overlay',
    )
    line_width_min: conint(ge=0) | None = Field(
        None,
        alias='lineWidthMin',
        description='Minimum stroke width of the hand-drawn highlight',
    )
    line_width_max: conint(ge=0) | None = Field(
        None,
        alias='lineWidthMax',
        description='Maximum stroke width of the hand-drawn highlight',
    )
    segments: conint(ge=1) | None = Field(
        None, description='Number of line segments in the hand-drawn rectangle'
    )
    coverage: confloat(ge=0.0, le=1.0) | None = Field(
        None, description='How much of the rectangle perimeter is drawn (0-1)'
    )


class Options(BaseModel):
    model_config = ConfigDict(
        extra='forbid',
        populate_by_name=True,
    )
    highlight_style: HighlightStyle | None = Field(None, alias='highlightStyle')
    voices: dict[str, Voices] | None = Field(
        None,
        description='Named voice identities mapping alias to gender (e.g. {"nathaly": "female", "james": "male"})',
    )
    debug_overlay: bool | None = Field(
        None, alias='debugOverlay', description='Show debug overlay in the final video'
    )
    font_size: conint(ge=8) | None = Field(
        None, alias='fontSize', description='Font size for debug overlay text'
    )


class Model(BaseModel):
    model_config = ConfigDict(
        extra='forbid',
        populate_by_name=True,
    )
    language: str = Field(..., description="Primary language code (e.g. 'en', 'de')")
    narrations: list[Narration]
    options: Options | None = None
