"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""

from __future__ import annotations
from .accounttaxprofilecreate import (
    AccountTaxProfileCreate,
    AccountTaxProfileCreateTypedDict,
)
from .identifiercreate import IdentifierCreate, IdentifierCreateTypedDict
from .interestedpartycreate import InterestedPartyCreate, InterestedPartyCreateTypedDict
from .investmentprofilecreate import (
    InvestmentProfileCreate,
    InvestmentProfileCreateTypedDict,
)
from .partyrequestcreate import PartyRequestCreate, PartyRequestCreateTypedDict
from .trustedcontactcreate import TrustedContactCreate, TrustedContactCreateTypedDict
from ascend_sdk import utils
from ascend_sdk.types import BaseModel
from ascend_sdk.utils import validate_open_enum
from enum import Enum
from pydantic.functional_validators import PlainValidator
from typing import List, Optional
from typing_extensions import Annotated, NotRequired, TypedDict


class CatAccountHolderType(str, Enum, metaclass=utils.OpenEnumMeta):
    r"""The FINRA CAT classification for the Account Holder; Is set automatically based on attributes of the owners and account type"""

    CAT_ACCOUNT_HOLDER_TYPE_UNSPECIFIED = "CAT_ACCOUNT_HOLDER_TYPE_UNSPECIFIED"
    A_INSTITUTIONAL_CUSTOMER = "A_INSTITUTIONAL_CUSTOMER"
    E_EMPLOYEE_ACCOUNT = "E_EMPLOYEE_ACCOUNT"
    F_FOREIGN = "F_FOREIGN"
    I_INDIVIDUAL = "I_INDIVIDUAL"
    O_MARKET_MAKING = "O_MARKET_MAKING"
    V_AGENCY_AVERAGE_PRICE_ACCOUNT = "V_AGENCY_AVERAGE_PRICE_ACCOUNT"
    P_OTHER_PROPRIETARY = "P_OTHER_PROPRIETARY"
    X_ERROR_ACCOUNT = "X_ERROR_ACCOUNT"


class AccountRequestCreateTypedDict(TypedDict):
    r"""A single record representing an owner or manager of an Account."""

    account_group_id: str
    r"""An Account Group is a way of segmenting accounts within a Correspondent; It is up to the client to define what these groups are and AFS Operations is responsible for configuring them; If the client requests additional groups/codes, they can be added; Examples of Account Groups could hypothetically include HNW (High Net Worth), GOLD (Gold Status Customer), and NWC (Northwest Branch Customer)"""
    correspondent_id: str
    r"""A unique identifier referencing a Correspondent; A Client may have several operating Correspondents within its purview."""
    parties: List[PartyRequestCreateTypedDict]
    r"""Parties associated with the account (e.g. custodian)."""
    accepts_issuer_direct_communication: NotRequired[bool]
    r"""Indicates if the issuer of a security held by the account is permitted to communicate directly with the shareholder versus through the brokerage firm; This can include sending proxy statements, annual reports, and other important information directly to the shareholder's address on file with the brokerage firm"""
    advised: NotRequired[bool]
    r"""A boolean to indicate if an account is advised"""
    cat_account_holder_type: NotRequired[CatAccountHolderType]
    r"""The FINRA CAT classification for the Account Holder; Is set automatically based on attributes of the owners and account type"""
    identifiers: NotRequired[List[IdentifierCreateTypedDict]]
    r"""A list of identifiers associated with the account"""
    interested_parties: NotRequired[List[InterestedPartyCreateTypedDict]]
    r"""A list of natural persons indicated to receive selected account documents such as account statements"""
    investment_profile: NotRequired[InvestmentProfileCreateTypedDict]
    r"""Investor profile."""
    managed: NotRequired[bool]
    r"""A boolean to indicate if an account is managed"""
    primary_registered_rep_id: NotRequired[str]
    r"""The primary registered representative for the account"""
    tax_profile: NotRequired[AccountTaxProfileCreateTypedDict]
    r"""The account tax profile."""
    trusted_contacts: NotRequired[List[TrustedContactCreateTypedDict]]
    r"""A list of persons designated to verify the well being of the account holder."""
    wrap_fee_billed: NotRequired[bool]
    r"""A boolean to indicate if an account is a wrap brokerage account"""


class AccountRequestCreate(BaseModel):
    r"""A single record representing an owner or manager of an Account."""

    account_group_id: str
    r"""An Account Group is a way of segmenting accounts within a Correspondent; It is up to the client to define what these groups are and AFS Operations is responsible for configuring them; If the client requests additional groups/codes, they can be added; Examples of Account Groups could hypothetically include HNW (High Net Worth), GOLD (Gold Status Customer), and NWC (Northwest Branch Customer)"""

    correspondent_id: str
    r"""A unique identifier referencing a Correspondent; A Client may have several operating Correspondents within its purview."""

    parties: List[PartyRequestCreate]
    r"""Parties associated with the account (e.g. custodian)."""

    accepts_issuer_direct_communication: Optional[bool] = None
    r"""Indicates if the issuer of a security held by the account is permitted to communicate directly with the shareholder versus through the brokerage firm; This can include sending proxy statements, annual reports, and other important information directly to the shareholder's address on file with the brokerage firm"""

    advised: Optional[bool] = None
    r"""A boolean to indicate if an account is advised"""

    cat_account_holder_type: Annotated[
        Optional[CatAccountHolderType], PlainValidator(validate_open_enum(False))
    ] = None
    r"""The FINRA CAT classification for the Account Holder; Is set automatically based on attributes of the owners and account type"""

    identifiers: Optional[List[IdentifierCreate]] = None
    r"""A list of identifiers associated with the account"""

    interested_parties: Optional[List[InterestedPartyCreate]] = None
    r"""A list of natural persons indicated to receive selected account documents such as account statements"""

    investment_profile: Optional[InvestmentProfileCreate] = None
    r"""Investor profile."""

    managed: Optional[bool] = None
    r"""A boolean to indicate if an account is managed"""

    primary_registered_rep_id: Optional[str] = None
    r"""The primary registered representative for the account"""

    tax_profile: Optional[AccountTaxProfileCreate] = None
    r"""The account tax profile."""

    trusted_contacts: Optional[List[TrustedContactCreate]] = None
    r"""A list of persons designated to verify the well being of the account holder."""

    wrap_fee_billed: Optional[bool] = None
    r"""A boolean to indicate if an account is a wrap brokerage account"""
