# generated by datamodel-codegen:
#   filename:  core/assets/video_asset.json
#   timestamp: 2026-02-28T17:39:50+00:00

from __future__ import annotations

from enum import Enum, IntEnum
from typing import Annotated

from adcp.types.base import AdCPBaseModel
from pydantic import AnyUrl, ConfigDict, Field

from .. import provenance as provenance_1


class AudioBitDepth(IntEnum):
    integer_16 = 16
    integer_24 = 24
    integer_32 = 32


class AudioChannels(Enum):
    mono = 'mono'
    stereo = 'stereo'
    field_5_1 = '5.1'
    field_7_1 = '7.1'


class ChromaSubsampling(Enum):
    field_4_2_0 = '4:2:0'
    field_4_2_2 = '4:2:2'
    field_4_4_4 = '4:4:4'


class ColorSpace(Enum):
    rec709 = 'rec709'
    rec2020 = 'rec2020'
    rec2100 = 'rec2100'
    srgb = 'srgb'
    dci_p3 = 'dci_p3'


class FrameRateType(Enum):
    constant = 'constant'
    variable = 'variable'


class GopType(Enum):
    closed = 'closed'
    open = 'open'


class HdrFormat(Enum):
    sdr = 'sdr'
    hdr10 = 'hdr10'
    hdr10_plus = 'hdr10_plus'
    hlg = 'hlg'
    dolby_vision = 'dolby_vision'


class MoovAtomPosition(Enum):
    start = 'start'
    end = 'end'


class ScanType(Enum):
    progressive = 'progressive'
    interlaced = 'interlaced'


class VideoBitDepth(IntEnum):
    integer_8 = 8
    integer_10 = 10
    integer_12 = 12


class VideoAsset(AdCPBaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    audio_bit_depth: Annotated[AudioBitDepth | None, Field(description='Audio bit depth')] = None
    audio_bitrate_kbps: Annotated[
        int | None, Field(description='Audio bitrate in kilobits per second', ge=1)
    ] = None
    audio_channels: Annotated[
        AudioChannels | None, Field(description='Audio channel configuration')
    ] = None
    audio_codec: Annotated[
        str | None,
        Field(description='Audio codec used (aac, aac_lc, he_aac, pcm, mp3, ac3, eac3, etc.)'),
    ] = None
    audio_description_url: Annotated[
        AnyUrl | None,
        Field(description='URL to audio description track for visually impaired users'),
    ] = None
    audio_loudness_lufs: Annotated[
        float | None, Field(description='Integrated loudness in LUFS')
    ] = None
    audio_sampling_rate_hz: Annotated[
        int | None, Field(description='Audio sampling rate in Hz (e.g., 44100, 48000)')
    ] = None
    audio_true_peak_dbfs: Annotated[float | None, Field(description='True peak level in dBFS')] = (
        None
    )
    captions_url: Annotated[
        AnyUrl | None, Field(description='URL to captions file (WebVTT, SRT, etc.)')
    ] = None
    chroma_subsampling: Annotated[
        ChromaSubsampling | None, Field(description='Chroma subsampling format')
    ] = None
    color_space: Annotated[ColorSpace | None, Field(description='Color space of the video')] = None
    container_format: Annotated[
        str | None, Field(description='Video container format (mp4, webm, mov, etc.)')
    ] = None
    duration_ms: Annotated[
        int | None, Field(description='Video duration in milliseconds', ge=1)
    ] = None
    file_size_bytes: Annotated[int | None, Field(description='File size in bytes', ge=1)] = None
    frame_rate: Annotated[
        str | None,
        Field(
            description="Frame rate as string to preserve precision (e.g., '23.976', '29.97', '30')"
        ),
    ] = None
    frame_rate_type: Annotated[
        FrameRateType | None,
        Field(description='Whether the video uses constant (CFR) or variable (VFR) frame rate'),
    ] = None
    gop_interval_seconds: Annotated[
        float | None, Field(description='GOP/keyframe interval in seconds')
    ] = None
    gop_type: Annotated[GopType | None, Field(description='GOP structure type')] = None
    has_audio: Annotated[
        bool | None, Field(description='Whether the video contains an audio track')
    ] = None
    hdr_format: Annotated[
        HdrFormat | None,
        Field(description="HDR format if applicable, or 'sdr' for standard dynamic range"),
    ] = None
    height: Annotated[int, Field(description='Height in pixels', ge=1)]
    moov_atom_position: Annotated[
        MoovAtomPosition | None, Field(description='Position of moov atom in MP4 container')
    ] = None
    provenance: Annotated[
        provenance_1.Provenance | None,
        Field(
            description='Provenance metadata for this asset, overrides manifest-level provenance'
        ),
    ] = None
    scan_type: Annotated[ScanType | None, Field(description='Scan type of the video')] = None
    transcript_url: Annotated[
        AnyUrl | None, Field(description='URL to text transcript of the video content')
    ] = None
    url: Annotated[AnyUrl, Field(description='URL to the video asset')]
    video_bit_depth: Annotated[VideoBitDepth | None, Field(description='Video bit depth')] = None
    video_bitrate_kbps: Annotated[
        int | None, Field(description='Video stream bitrate in kilobits per second', ge=1)
    ] = None
    video_codec: Annotated[
        str | None, Field(description='Video codec used (h264, h265, vp9, av1, prores, etc.)')
    ] = None
    width: Annotated[int, Field(description='Width in pixels', ge=1)]
