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

import datetime as dt
import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2
from ..core.unchecked_base_model import UncheckedBaseModel
from .integration_connection_auth_type import IntegrationConnectionAuthType
from .integration_connection_integration_type import IntegrationConnectionIntegrationType


class IntegrationConnection(UncheckedBaseModel):
    id: str
    auth_client: str
    integration_type: IntegrationConnectionIntegrationType
    auth_type: IntegrationConnectionAuthType
    api_key_secret_ref: typing.Optional[str] = None
    access_token_secret_ref: typing.Optional[str] = None
    refresh_token_secret_ref: typing.Optional[str] = None
    connected: bool
    metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = None
    scopes: typing.Optional[typing.List[str]] = None
    created_at: dt.datetime
    updated_at: dt.datetime
    expires_in: typing.Optional[int] = None
    has_permission: typing.Optional[bool] = 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
