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

from __future__ import annotations
from .datecreate import DateCreate, DateCreateTypedDict
from .phonenumbercreate import PhoneNumberCreate, PhoneNumberCreateTypedDict
from .postaladdresscreate import PostalAddressCreate, PostalAddressCreateTypedDict
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 Optional
from typing_extensions import Annotated, NotRequired, TypedDict


class BeneficiaryCreateEntityType(str, Enum, metaclass=utils.OpenEnumMeta):
    r"""The entity type of the beneficiary; Required if the beneficiary is a legal entity."""

    ENTITY_TYPE_UNSPECIFIED = "ENTITY_TYPE_UNSPECIFIED"
    CORPORATION = "CORPORATION"
    LIMITED_LIABILITY_COMPANY = "LIMITED_LIABILITY_COMPANY"
    PARTNERSHIP = "PARTNERSHIP"
    SOLE_PROPRIETORSHIP_OR_SINGLE_MEMBER_LLC = (
        "SOLE_PROPRIETORSHIP_OR_SINGLE_MEMBER_LLC"
    )
    TRUST = "TRUST"
    ESTATE = "ESTATE"


class BeneficiaryCreateRelationType(str, Enum, metaclass=utils.OpenEnumMeta):
    r"""The relationship of the beneficiary to the account owner"""

    RELATION_TYPE_UNSPECIFIED = "RELATION_TYPE_UNSPECIFIED"
    SPOUSE = "SPOUSE"
    TRUST = "TRUST"
    OTHER = "OTHER"


class BeneficiaryCreateTaxIDType(str, Enum, metaclass=utils.OpenEnumMeta):
    r"""The nature of the U.S. Tax ID indicated in the related tax_id field; Examples include ITIN, SSN, EIN. Tax id type is required if birth date is not provided."""

    TAX_ID_TYPE_UNSPECIFIED = "TAX_ID_TYPE_UNSPECIFIED"
    TAX_ID_TYPE_SSN = "TAX_ID_TYPE_SSN"
    TAX_ID_TYPE_ITIN = "TAX_ID_TYPE_ITIN"
    TAX_ID_TYPE_EIN = "TAX_ID_TYPE_EIN"


class BeneficiaryCreateTypedDict(TypedDict):
    r"""The beneficiary for transfer on death."""

    beneficiary_percentage: int
    r"""An integer conveying the percentage of interest the related Beneficiary has in the account if the owner(s) become deceased; The sum of all beneficiary percentages must equal \"100\" """
    birth_date: NotRequired[DateCreateTypedDict]
    r"""Represents a whole or partial calendar date, such as a birthday. The time of day and time zone are either specified elsewhere or are insignificant. The date is relative to the Gregorian Calendar. This can represent one of the following:

    * A full date, with non-zero year, month, and day values * A month and day value, with a zero year, such as an anniversary * A year on its own, with zero month and day values * A year and month value, with a zero day, such as a credit card expiration date

    Related types are [google.type.TimeOfDay][google.type.TimeOfDay] and `google.protobuf.Timestamp`.
    """
    email: NotRequired[str]
    r"""Beneficiaries may provide an email, a mailing_address, or both An email address indicated for account communications"""
    entity_name: NotRequired[str]
    r"""The legal entity name; Required if the beneficiary is a legal entity."""
    entity_type: NotRequired[BeneficiaryCreateEntityType]
    r"""The entity type of the beneficiary; Required if the beneficiary is a legal entity."""
    family_name: NotRequired[str]
    r"""Family name of a natural person; Required if the beneficiary is a natural person."""
    given_name: NotRequired[str]
    r"""The given name of a natural person; Conventionally known as 'first name' in most English-speaking countries.Required if the beneficiary is a natural person."""
    mailing_address: NotRequired[PostalAddressCreateTypedDict]
    r"""Represents a postal address, e.g. for postal delivery or payments addresses. Given a postal address, a postal service can deliver items to a premise, P.O. Box or similar. It is not intended to model geographical locations (roads, towns, mountains).

    In typical usage an address would be created via user input or from importing existing data, depending on the type of process.

    Advice on address input / editing: - Use an i18n-ready address widget such as  https://github.com/google/libaddressinput) - Users should not be presented with UI elements for input or editing of  fields outside countries where that field is used.

    For more guidance on how to use this schema, please see: https://support.google.com/business/answer/6397478
    """
    middle_names: NotRequired[str]
    r"""Non-primary names representing a natural person; Name attributed to a person other than \"Given\" and \"Family\" names."""
    phone_number: NotRequired[PhoneNumberCreateTypedDict]
    r"""An object representing a phone number, suitable as an API wire format.

    This representation:

    - should not be used for locale-specific formatting of a phone number, such  as \"+1 (650) 253-0000 ext. 123\" 

    - is not designed for efficient storage - may not be suitable for dialing - specialized libraries (see references)  should be used to parse the number for that purpose

    To do something meaningful with this number, such as format it for various use-cases, convert it to an `i18n.phonenumbers.PhoneNumber` object first.

    For instance, in Java this would be:

    com.google.type.PhoneNumber wireProto =    com.google.type.PhoneNumber.newBuilder().build();  com.google.i18n.phonenumbers.Phonenumber.PhoneNumber phoneNumber =    PhoneNumberUtil.getInstance().parse(wireProto.getE164Number(), \"ZZ\");  if (!wireProto.getExtension().isEmpty()) {   phoneNumber.setExtension(wireProto.getExtension());  }

    Reference(s):
    - https://github.com/google/libphonenumber
    """
    relation_type: NotRequired[BeneficiaryCreateRelationType]
    r"""The relationship of the beneficiary to the account owner"""
    tax_id: NotRequired[str]
    r"""The full U.S. tax ID for a related person; Tax ID is required if birth date is not provided."""
    tax_id_type: NotRequired[BeneficiaryCreateTaxIDType]
    r"""The nature of the U.S. Tax ID indicated in the related tax_id field; Examples include ITIN, SSN, EIN. Tax id type is required if birth date is not provided."""


class BeneficiaryCreate(BaseModel):
    r"""The beneficiary for transfer on death."""

    beneficiary_percentage: int
    r"""An integer conveying the percentage of interest the related Beneficiary has in the account if the owner(s) become deceased; The sum of all beneficiary percentages must equal \"100\" """

    birth_date: Optional[DateCreate] = None
    r"""Represents a whole or partial calendar date, such as a birthday. The time of day and time zone are either specified elsewhere or are insignificant. The date is relative to the Gregorian Calendar. This can represent one of the following:

    * A full date, with non-zero year, month, and day values * A month and day value, with a zero year, such as an anniversary * A year on its own, with zero month and day values * A year and month value, with a zero day, such as a credit card expiration date

    Related types are [google.type.TimeOfDay][google.type.TimeOfDay] and `google.protobuf.Timestamp`.
    """

    email: Optional[str] = None
    r"""Beneficiaries may provide an email, a mailing_address, or both An email address indicated for account communications"""

    entity_name: Optional[str] = None
    r"""The legal entity name; Required if the beneficiary is a legal entity."""

    entity_type: Annotated[
        Optional[BeneficiaryCreateEntityType], PlainValidator(validate_open_enum(False))
    ] = None
    r"""The entity type of the beneficiary; Required if the beneficiary is a legal entity."""

    family_name: Optional[str] = None
    r"""Family name of a natural person; Required if the beneficiary is a natural person."""

    given_name: Optional[str] = None
    r"""The given name of a natural person; Conventionally known as 'first name' in most English-speaking countries.Required if the beneficiary is a natural person."""

    mailing_address: Optional[PostalAddressCreate] = None
    r"""Represents a postal address, e.g. for postal delivery or payments addresses. Given a postal address, a postal service can deliver items to a premise, P.O. Box or similar. It is not intended to model geographical locations (roads, towns, mountains).

    In typical usage an address would be created via user input or from importing existing data, depending on the type of process.

    Advice on address input / editing: - Use an i18n-ready address widget such as  https://github.com/google/libaddressinput) - Users should not be presented with UI elements for input or editing of  fields outside countries where that field is used.

    For more guidance on how to use this schema, please see: https://support.google.com/business/answer/6397478
    """

    middle_names: Optional[str] = None
    r"""Non-primary names representing a natural person; Name attributed to a person other than \"Given\" and \"Family\" names."""

    phone_number: Optional[PhoneNumberCreate] = None
    r"""An object representing a phone number, suitable as an API wire format.

    This representation:

    - should not be used for locale-specific formatting of a phone number, such  as \"+1 (650) 253-0000 ext. 123\" 

    - is not designed for efficient storage - may not be suitable for dialing - specialized libraries (see references)  should be used to parse the number for that purpose

    To do something meaningful with this number, such as format it for various use-cases, convert it to an `i18n.phonenumbers.PhoneNumber` object first.

    For instance, in Java this would be:

    com.google.type.PhoneNumber wireProto =    com.google.type.PhoneNumber.newBuilder().build();  com.google.i18n.phonenumbers.Phonenumber.PhoneNumber phoneNumber =    PhoneNumberUtil.getInstance().parse(wireProto.getE164Number(), \"ZZ\");  if (!wireProto.getExtension().isEmpty()) {   phoneNumber.setExtension(wireProto.getExtension());  }

    Reference(s):
    - https://github.com/google/libphonenumber
    """

    relation_type: Annotated[
        Optional[BeneficiaryCreateRelationType],
        PlainValidator(validate_open_enum(False)),
    ] = None
    r"""The relationship of the beneficiary to the account owner"""

    tax_id: Optional[str] = None
    r"""The full U.S. tax ID for a related person; Tax ID is required if birth date is not provided."""

    tax_id_type: Annotated[
        Optional[BeneficiaryCreateTaxIDType], PlainValidator(validate_open_enum(False))
    ] = None
    r"""The nature of the U.S. Tax ID indicated in the related tax_id field; Examples include ITIN, SSN, EIN. Tax id type is required if birth date is not provided."""
