# generated by datamodel-codegen:
#   filename:  config-schema.json
#   timestamp: 2026-03-09T23:58:19+00:00

from __future__ import annotations

from enum import StrEnum

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


class Codec(StrEnum):
    libx264 = 'libx264'
    libx265 = 'libx265'
    libvpx_vp9 = 'libvpx-vp9'


class Preset(StrEnum):
    ultrafast = 'ultrafast'
    superfast = 'superfast'
    veryfast = 'veryfast'
    faster = 'faster'
    fast = 'fast'
    medium = 'medium'
    slow = 'slow'
    slower = 'slower'
    veryslow = 'veryslow'


class PixelFormat(StrEnum):
    yuv420p = 'yuv420p'
    yuv444p = 'yuv444p'


class RecordingConfig(BaseModel):
    model_config = ConfigDict(
        extra='forbid',
        populate_by_name=True,
    )
    fps: conint(ge=1) = Field(
        ..., description='Target frames per second for video output'
    )
    jpeg_quality: conint(ge=1, le=100) = Field(
        ..., alias='jpegQuality', description='JPEG quality for CDP screencast frames'
    )
    min_frames: conint(ge=1) = Field(
        ...,
        alias='minFrames',
        description='Minimum frames to capture before considering recording started',
    )
    min_frame_wait_ms: conint(ge=1) = Field(
        ...,
        alias='minFrameWaitMs',
        description='Polling interval in ms when waiting for minimum frames',
    )
    stop_settle_ms: conint(ge=0) = Field(
        ...,
        alias='stopSettleMs',
        description='Settle time in ms after stopping the screencast before closing ffmpeg',
    )
    codec: Codec = Field(..., description='Video codec for ffmpeg output')
    preset: Preset = Field(
        ...,
        description='Encoding speed preset (faster = larger file, slower = smaller file)',
    )
    crf: conint(ge=0, le=51) = Field(
        ...,
        description='Constant rate factor (0 = lossless, 18 = visually lossless, 23 = default, 51 = worst)',
    )
    pixel_format: PixelFormat = Field(
        ..., alias='pixelFormat', description='Pixel format for video output'
    )


class HighlightConfig(BaseModel):
    model_config = ConfigDict(
        extra='forbid',
        populate_by_name=True,
    )
    scroll_wait_ms: conint(ge=0) = Field(..., alias='scrollWaitMs')
    draw_wait_ms: conint(ge=0) = Field(..., alias='drawWaitMs')
    remove_wait_ms: conint(ge=0) = Field(..., alias='removeWaitMs')
    color: str
    padding: conint(ge=0)
    animation_speed_ms: conint(ge=0) = Field(..., alias='animationSpeedMs')
    line_width_min: conint(ge=0) = Field(..., alias='lineWidthMin')
    line_width_max: conint(ge=0) = Field(..., alias='lineWidthMax')
    opacity: confloat(ge=0.0, le=1.0)
    segments: conint(ge=1)
    coverage: confloat(ge=0.0, le=1.0)
    scroll_js: str = Field(
        ...,
        alias='scrollJs',
        description='JS file path or inline code for scrolling element into view',
    )
    scroll_wait_js: str = Field(
        ...,
        alias='scrollWaitJs',
        description='JS file path or inline code for waiting after scroll',
    )
    draw_js: str = Field(
        ...,
        alias='drawJs',
        description='JS file path or inline code for drawing the highlight',
    )
    remove_js: str = Field(
        ...,
        alias='removeJs',
        description='JS file path or inline code for removing the highlight',
    )


class Model(BaseModel):
    model_config = ConfigDict(
        extra='forbid',
        populate_by_name=True,
    )
    recording: RecordingConfig
    highlight: HighlightConfig
