"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
# @generated-id: 0fd79f1f0920

from __future__ import annotations
from .account_details import AccountDetails, AccountDetailsTypedDict
from .account_status import AccountStatus
from .balance import Balance, BalanceTypedDict
from .mode import Mode
from mollie import models
from mollie.types import BaseModel
import pydantic
from pydantic import field_serializer
from typing_extensions import Annotated, TypedDict


class BusinessAccountResponseTypedDict(TypedDict):
    resource: str
    r"""Indicates the response contains a business account object. Will always contain the string `business-account`
    for this endpoint.
    """
    id: str
    r"""The identifier uniquely referring to this business account. Mollie assigns this identifier at account creation
    time.
    """
    account_details: AccountDetailsTypedDict
    r"""The account holder details and bank account information for the business account."""
    balance: BalanceTypedDict
    r"""The balance of the business account."""
    status: AccountStatus
    r"""The status of the business account."""
    mode: Mode
    r"""Whether this entity was created in live mode or in test mode."""
    created_at: str
    r"""The entity's date and time of creation, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format."""


class BusinessAccountResponse(BaseModel):
    resource: str
    r"""Indicates the response contains a business account object. Will always contain the string `business-account`
    for this endpoint.
    """

    id: str
    r"""The identifier uniquely referring to this business account. Mollie assigns this identifier at account creation
    time.
    """

    account_details: Annotated[AccountDetails, pydantic.Field(alias="accountDetails")]
    r"""The account holder details and bank account information for the business account."""

    balance: Balance
    r"""The balance of the business account."""

    status: AccountStatus
    r"""The status of the business account."""

    mode: Mode
    r"""Whether this entity was created in live mode or in test mode."""

    created_at: Annotated[str, pydantic.Field(alias="createdAt")]
    r"""The entity's date and time of creation, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format."""

    @field_serializer("status")
    def serialize_status(self, value):
        if isinstance(value, str):
            try:
                return models.AccountStatus(value)
            except ValueError:
                return value
        return value

    @field_serializer("mode")
    def serialize_mode(self, value):
        if isinstance(value, str):
            try:
                return models.Mode(value)
            except ValueError:
                return value
        return value


try:
    BusinessAccountResponse.model_rebuild()
except NameError:
    pass
