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

from ..core.pydantic_utilities import UniversalBaseModel
import typing
import pydantic
import datetime as dt
from .plaid_account_status import PlaidAccountStatus
import typing_extensions
from ..core.serialization import FieldMetadata
from ..core.pydantic_utilities import IS_PYDANTIC_V2


class PlaidAccount(UniversalBaseModel):
    id: typing.Optional[str] = pydantic.Field(default=None)
    """
    Unique identifier for the Plaid account
    """

    plaid_access_token: typing.Optional[str] = pydantic.Field(default=None)
    """
    Plaid access token
    """

    plaid_item_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    Plaid item ID
    """

    plaid_institution_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    Plaid institution ID
    """

    plaid_account_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    Plaid account ID
    """

    account_name: typing.Optional[str] = pydantic.Field(default=None)
    """
    Name of the account
    """

    account_type: typing.Optional[str] = pydantic.Field(default=None)
    """
    Type of the account
    """

    account_subtype: typing.Optional[str] = pydantic.Field(default=None)
    """
    Subtype of the account
    """

    account_mask: typing.Optional[str] = pydantic.Field(default=None)
    """
    Masked account number
    """

    linked_at: typing.Optional[dt.datetime] = pydantic.Field(default=None)
    """
    Date when the account was linked
    """

    status: typing.Optional[PlaidAccountStatus] = pydantic.Field(default=None)
    """
    Status of the account
    """

    company_id: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="companyId")] = pydantic.Field(
        default=None
    )
    """
    ID of the company
    """

    cursor: typing.Optional[str] = pydantic.Field(default=None)
    """
    Cursor for pagination
    """

    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
