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

import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from .logging_mode import LoggingMode
from .retry_config import RetryConfig
from .semantic_cache_settings import SemanticCacheSettings


class GlobalSettings(UniversalBaseModel):
    """
    Configure global gateway settings that apply to all requests processed by the gateway. These settings establish default behaviors for retry logic, guardrail enforcement, and request logging that can be overridden by route-specific configurations or request headers. Use these settings to define baseline policies for reliability, security, and observability across your entire gateway deployment.
    """

    type: typing.Literal["gateway-global-settings"] = pydantic.Field(default="gateway-global-settings")
    """
    +value=gateway-global-settings
    +sort=2
    """

    retry_settings: typing.Optional[RetryConfig] = None
    logging_settings: typing.Optional[LoggingMode] = None
    semantic_cache_settings: typing.Optional[SemanticCacheSettings] = None

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

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