# 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, UniversalBaseModel


class ConnectionInfo(UniversalBaseModel):
    """
    User connection info for a specific tool.
    """

    id: str = pydantic.Field()
    """
    Connection/credential ID
    """

    tool_key: str = pydantic.Field()
    """
    Tool key (e.g., 'clickup', 'github')
    """

    display_name: str = pydantic.Field()
    """
    Display name shown in dropdown (e.g., 'My Account - ClickUp')
    """

    credential_name: typing.Optional[str] = pydantic.Field(default=None)
    """
    User-editable name for the credential
    """

    account_email: typing.Optional[str] = pydantic.Field(default=None)
    """
    Connected account email if available
    """

    connection_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    External connection ID
    """

    is_active: typing.Optional[bool] = pydantic.Field(default=None)
    """
    Whether connection is active
    """

    created_at: typing.Optional[dt.datetime] = pydantic.Field(default=None)
    """
    When the connection was created
    """

    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
