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

from __future__ import annotations
from abbyy_document_ai.types import BaseModel
from datetime import date
import pydantic
from typing import List, Optional
from typing_extensions import Annotated, NotRequired, TypedDict


class BrokerTypedDict(TypedDict):
    name: NotRequired[str]
    r"""The name of the broker"""
    address: NotRequired[str]
    r"""The address of the broker"""
    phone_number: NotRequired[str]
    r"""The phone number of the broker"""


class Broker(BaseModel):
    name: Optional[str] = None
    r"""The name of the broker"""

    address: Optional[str] = None
    r"""The address of the broker"""

    phone_number: Annotated[Optional[str], pydantic.Field(alias="phoneNumber")] = None
    r"""The phone number of the broker"""


class AdvisorTypedDict(TypedDict):
    name: NotRequired[str]
    r"""The name of the advisor"""
    phone_number: NotRequired[str]
    r"""The phone number of the advisor"""
    address: NotRequired[str]
    r"""The address of the advisor"""


class Advisor(BaseModel):
    name: Optional[str] = None
    r"""The name of the advisor"""

    phone_number: Annotated[Optional[str], pydantic.Field(alias="phoneNumber")] = None
    r"""The phone number of the advisor"""

    address: Optional[str] = None
    r"""The address of the advisor"""


class ClientTypedDict(TypedDict):
    name: NotRequired[str]
    r"""The name of the client"""
    address: NotRequired[str]
    r"""The address of the client"""
    phone_number: NotRequired[str]
    r"""The phone number of the client"""


class Client(BaseModel):
    name: Optional[str] = None
    r"""The name of the client"""

    address: Optional[str] = None
    r"""The address of the client"""

    phone_number: Annotated[Optional[str], pydantic.Field(alias="phoneNumber")] = None
    r"""The phone number of the client"""


class HoldingsLevelTypedDict(TypedDict):
    account_type: NotRequired[str]
    r"""The type of account in which the investor holds the securities listed on the statement"""
    asset_class: NotRequired[str]
    r"""The classification of the investments held in the brokerage account according to their asset class"""
    description: NotRequired[str]
    r"""A detailed description of each investment held in the brokerage account"""
    symbol: NotRequired[str]
    r"""The unique ticker symbol assigned to each investment held in the brokerage account"""
    cusip: NotRequired[str]
    r"""The unique identifier assigned to each security registered with the Committee on Uniform Securities Identification Procedures (CUSIP)"""
    quantity: NotRequired[float]
    r"""The number of shares or units of a security that are held in the investor's brokerage account"""
    price: NotRequired[float]
    r"""The price per share or unit of a security at the time it was acquired by the investor"""
    price_as_of_date: NotRequired[date]
    r"""The date on which the price per share or unit of a security was last updated or determined by the broker"""
    currency: NotRequired[str]
    r"""The currency in which the security is denominated or traded"""
    market_value: NotRequired[float]
    r"""The current market value of an investor's holdings of a particular security"""
    prior_market_value: NotRequired[float]
    r"""The market value of an investor's holdings of a particular security as of the previous statement date"""
    cost_basis: NotRequired[float]
    r"""The total amount an investor has paid to acquire their current holdings of a particular security"""
    accrued_value: NotRequired[float]
    r"""The value of the investor's accrued earnings on the security"""
    estimated_income: NotRequired[float]
    r"""The estimated income that includes interest, dividends, and other income that the investor is expected to receive from their holdings"""
    estimated_yield: NotRequired[float]
    r"""The estimated yield that an investor can expect to earn from their holdings of a particular security over a given period of time"""
    current_yield: NotRequired[float]
    r"""The actual yield an investor is currently earning from their holdings of a particular security"""


class HoldingsLevel(BaseModel):
    account_type: Annotated[Optional[str], pydantic.Field(alias="accountType")] = None
    r"""The type of account in which the investor holds the securities listed on the statement"""

    asset_class: Annotated[Optional[str], pydantic.Field(alias="assetClass")] = None
    r"""The classification of the investments held in the brokerage account according to their asset class"""

    description: Optional[str] = None
    r"""A detailed description of each investment held in the brokerage account"""

    symbol: Optional[str] = None
    r"""The unique ticker symbol assigned to each investment held in the brokerage account"""

    cusip: Optional[str] = None
    r"""The unique identifier assigned to each security registered with the Committee on Uniform Securities Identification Procedures (CUSIP)"""

    quantity: Optional[float] = None
    r"""The number of shares or units of a security that are held in the investor's brokerage account"""

    price: Optional[float] = None
    r"""The price per share or unit of a security at the time it was acquired by the investor"""

    price_as_of_date: Annotated[
        Optional[date], pydantic.Field(alias="priceAsOfDate")
    ] = None
    r"""The date on which the price per share or unit of a security was last updated or determined by the broker"""

    currency: Optional[str] = None
    r"""The currency in which the security is denominated or traded"""

    market_value: Annotated[Optional[float], pydantic.Field(alias="marketValue")] = None
    r"""The current market value of an investor's holdings of a particular security"""

    prior_market_value: Annotated[
        Optional[float], pydantic.Field(alias="priorMarketValue")
    ] = None
    r"""The market value of an investor's holdings of a particular security as of the previous statement date"""

    cost_basis: Annotated[Optional[float], pydantic.Field(alias="costBasis")] = None
    r"""The total amount an investor has paid to acquire their current holdings of a particular security"""

    accrued_value: Annotated[Optional[float], pydantic.Field(alias="accruedValue")] = (
        None
    )
    r"""The value of the investor's accrued earnings on the security"""

    estimated_income: Annotated[
        Optional[float], pydantic.Field(alias="estimatedIncome")
    ] = None
    r"""The estimated income that includes interest, dividends, and other income that the investor is expected to receive from their holdings"""

    estimated_yield: Annotated[
        Optional[float], pydantic.Field(alias="estimatedYield")
    ] = None
    r"""The estimated yield that an investor can expect to earn from their holdings of a particular security over a given period of time"""

    current_yield: Annotated[Optional[float], pydantic.Field(alias="currentYield")] = (
        None
    )
    r"""The actual yield an investor is currently earning from their holdings of a particular security"""


class TransactionsTypedDict(TypedDict):
    trade_date: NotRequired[str]
    r"""The date on which a particular trade was executed"""
    settlement_date: NotRequired[str]
    r"""The date on which the settlement process is complete"""
    account_type: NotRequired[str]
    r"""The type of account associated with a particular trade transaction"""
    transaction_type_level1: NotRequired[str]
    r"""The broad category or type of a particular trade transaction"""
    transaction_type_level2: NotRequired[str]
    r"""Additional detail about the specific type of trade transaction that occurred"""
    transaction_type: NotRequired[str]
    r"""The specific type of transaction that occurred in an investor's account during the statement period"""
    description: NotRequired[str]
    r"""Additional details about the specific transaction that occurred in an investor's account"""
    symbol: NotRequired[str]
    r"""The ticker symbol of the security that was involved in a particular transaction"""
    quantity: NotRequired[float]
    r"""The number of shares, units, or contracts involved in a particular transaction"""
    price: NotRequired[float]
    r"""The price at which a security was bought or sold during a particular transaction"""
    currency: NotRequired[str]
    r"""The currency in which a particular transaction was executed"""
    amount: NotRequired[float]
    r"""The total amount associated with a particular transaction"""
    taxable_amount: NotRequired[float]
    r"""The amount of taxable income associated with specific transactions"""
    non_taxable_amount: NotRequired[float]
    r"""The amount of income or proceeds from tax-exempt transactions"""
    pending_status: NotRequired[str]
    r"""The current status of a transaction that is pending or not yet completed"""


class Transactions(BaseModel):
    trade_date: Annotated[Optional[str], pydantic.Field(alias="tradeDate")] = None
    r"""The date on which a particular trade was executed"""

    settlement_date: Annotated[
        Optional[str], pydantic.Field(alias="settlementDate")
    ] = None
    r"""The date on which the settlement process is complete"""

    account_type: Annotated[Optional[str], pydantic.Field(alias="accountType")] = None
    r"""The type of account associated with a particular trade transaction"""

    transaction_type_level1: Annotated[
        Optional[str], pydantic.Field(alias="transactionTypeLevel1")
    ] = None
    r"""The broad category or type of a particular trade transaction"""

    transaction_type_level2: Annotated[
        Optional[str], pydantic.Field(alias="transactionTypeLevel2")
    ] = None
    r"""Additional detail about the specific type of trade transaction that occurred"""

    transaction_type: Annotated[
        Optional[str], pydantic.Field(alias="transactionType")
    ] = None
    r"""The specific type of transaction that occurred in an investor's account during the statement period"""

    description: Optional[str] = None
    r"""Additional details about the specific transaction that occurred in an investor's account"""

    symbol: Optional[str] = None
    r"""The ticker symbol of the security that was involved in a particular transaction"""

    quantity: Optional[float] = None
    r"""The number of shares, units, or contracts involved in a particular transaction"""

    price: Optional[float] = None
    r"""The price at which a security was bought or sold during a particular transaction"""

    currency: Optional[str] = None
    r"""The currency in which a particular transaction was executed"""

    amount: Optional[float] = None
    r"""The total amount associated with a particular transaction"""

    taxable_amount: Annotated[
        Optional[float], pydantic.Field(alias="taxableAmount")
    ] = None
    r"""The amount of taxable income associated with specific transactions"""

    non_taxable_amount: Annotated[
        Optional[float], pydantic.Field(alias="nonTaxableAmount")
    ] = None
    r"""The amount of income or proceeds from tax-exempt transactions"""

    pending_status: Annotated[Optional[str], pydantic.Field(alias="pendingStatus")] = (
        None
    )
    r"""The current status of a transaction that is pending or not yet completed"""


class BrokerageStatementFieldsTypedDict(TypedDict):
    r"""Fields extracted from a brokerage statement"""

    account_number: NotRequired[str]
    r"""The unique number assigned to an investment account by the broker or investment firm"""
    broker: NotRequired[BrokerTypedDict]
    advisor: NotRequired[List[AdvisorTypedDict]]
    client: NotRequired[ClientTypedDict]
    statement_start_date: NotRequired[date]
    r"""The beginning of the statement period for which the statement was generated"""
    statement_end_date: NotRequired[date]
    r"""The end of the statement period for which the statement was generated"""
    statement_period: NotRequired[str]
    r"""The period between the statement start date and the statement end date"""
    total_portfolio_value: NotRequired[float]
    r"""The total value of an investor's investment holdings within the account as of the statement date"""
    base_currency: NotRequired[str]
    r"""The currency that is used to calculate the value of the account's holdings and any gains or losses"""
    holdings_level: NotRequired[List[HoldingsLevelTypedDict]]
    transactions: NotRequired[List[TransactionsTypedDict]]


class BrokerageStatementFields(BaseModel):
    r"""Fields extracted from a brokerage statement"""

    account_number: Annotated[Optional[str], pydantic.Field(alias="accountNumber")] = (
        None
    )
    r"""The unique number assigned to an investment account by the broker or investment firm"""

    broker: Optional[Broker] = None

    advisor: Optional[List[Advisor]] = None

    client: Optional[Client] = None

    statement_start_date: Annotated[
        Optional[date], pydantic.Field(alias="statementStartDate")
    ] = None
    r"""The beginning of the statement period for which the statement was generated"""

    statement_end_date: Annotated[
        Optional[date], pydantic.Field(alias="statementEndDate")
    ] = None
    r"""The end of the statement period for which the statement was generated"""

    statement_period: Annotated[
        Optional[str], pydantic.Field(alias="statementPeriod")
    ] = None
    r"""The period between the statement start date and the statement end date"""

    total_portfolio_value: Annotated[
        Optional[float], pydantic.Field(alias="totalPortfolioValue")
    ] = None
    r"""The total value of an investor's investment holdings within the account as of the statement date"""

    base_currency: Annotated[Optional[str], pydantic.Field(alias="baseCurrency")] = None
    r"""The currency that is used to calculate the value of the account's holdings and any gains or losses"""

    holdings_level: Annotated[
        Optional[List[HoldingsLevel]], pydantic.Field(alias="holdingsLevel")
    ] = None

    transactions: Optional[List[Transactions]] = None
