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

from __future__ import annotations
from ...core.unchecked_base_model import UncheckedBaseModel
import typing
from .http_receiver_basic_credential import HttpReceiverBasicCredential
from ...core.pydantic_utilities import IS_PYDANTIC_V2
import pydantic
from .http_receiver_o_auth_style import HttpReceiverOAuthStyle
from .http_receiver_o_auth_credential import HttpReceiverOAuthCredential
from .http_receiver_token_credential import HttpReceiverTokenCredential
import typing_extensions
from ...core.unchecked_base_model import UnionMetadata


class HttpReceiverAuthConfig_BasicConfig(UncheckedBaseModel):
    type: typing.Literal["basic_config"] = "basic_config"
    credential: HttpReceiverBasicCredential

    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


class HttpReceiverAuthConfig_OAuthClientConfig(UncheckedBaseModel):
    type: typing.Literal["o_auth_client_config"] = "o_auth_client_config"
    auth_style: typing.Optional[HttpReceiverOAuthStyle] = None
    credential: HttpReceiverOAuthCredential
    endpoint_params: typing.Optional[typing.Dict[str, str]] = None
    scopes: typing.Optional[typing.List[str]] = 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


class HttpReceiverAuthConfig_TokenConfig(UncheckedBaseModel):
    type: typing.Literal["token_config"] = "token_config"
    credential: HttpReceiverTokenCredential
    header_name: typing.Optional[str] = None
    template: typing.Optional[str] = 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


HttpReceiverAuthConfig = typing_extensions.Annotated[
    typing.Union[
        HttpReceiverAuthConfig_BasicConfig,
        HttpReceiverAuthConfig_OAuthClientConfig,
        HttpReceiverAuthConfig_TokenConfig,
    ],
    UnionMetadata(discriminant="type"),
]
