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

import typing

import pydantic
import typing_extensions
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from ..core.serialization import FieldMetadata
from .push_notification_mode import PushNotificationMode


class PushNotificationSettings(UniversalBaseModel):
    """
    Push-channel preferences.
    """

    mode: typing.Optional[PushNotificationMode] = pydantic.Field(default=None)
    """
    Delivery mode. `always` = send on every response completion. `smart` = skip when the user has an active stream on the same thread. `away_only` = skip whenever the user has any active stream. `never` = never send.
    """

    rate_limit_seconds: typing_extensions.Annotated[
        typing.Optional[int],
        FieldMetadata(alias="rateLimitSeconds"),
        pydantic.Field(
            alias="rateLimitSeconds", description="Per-user cooldown override. null = inherit server default."
        ),
    ] = None

    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
