# 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 ...core.pydantic_utilities import IS_PYDANTIC_V2
import pydantic
from ...credentials.types.token_credential_id import TokenCredentialId
import typing_extensions
from ...core.unchecked_base_model import UnionMetadata


class OpenTextApplicationSecurityCredential_Token(UncheckedBaseModel):
    type: typing.Literal["token"] = "token"
    secret: str

    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 OpenTextApplicationSecurityCredential_TokenId(UncheckedBaseModel):
    value: TokenCredentialId
    type: typing.Literal["token_id"] = "token_id"

    class Config:
        smart_union = True


OpenTextApplicationSecurityCredential = typing_extensions.Annotated[
    typing.Union[
        OpenTextApplicationSecurityCredential_Token,
        OpenTextApplicationSecurityCredential_TokenId,
    ],
    UnionMetadata(discriminant="type"),
]
