# This file was auto-generated by Fern from our API Definition.

import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2
from ..core.unchecked_base_model import UncheckedBaseModel
from .background_sound_preset_id import BackgroundSoundPresetId
from .background_sound_source_type import BackgroundSoundSourceType


class BackgroundSoundConfig(UncheckedBaseModel):
    source_type: typing.Optional[BackgroundSoundSourceType] = pydantic.Field(default=None)
    """
    The type of background sound source.
    """

    source_id: typing.Optional[BackgroundSoundPresetId] = pydantic.Field(default=None)
    """
    Identifier for the sound source.
    """

    volume: typing.Optional[float] = pydantic.Field(default=None)
    """
    Volume level for background sound (0.01 to 1.0).
    """

    crossfade_loop: typing.Optional[bool] = pydantic.Field(default=None)
    """
    Apply a crossfade at the loop boundary to avoid audible pops when the sound loops.
    """

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow
