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

from __future__ import annotations
from .decimalcreate import DecimalCreate, DecimalCreateTypedDict
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 TransfersCreditCreateType(str, Enum, metaclass=utils.OpenEnumMeta):
    r"""The type of the credit being issued"""

    TYPE_UNSPECIFIED = "TYPE_UNSPECIFIED"
    PROMOTIONAL = "PROMOTIONAL"
    WRITE_OFF = "WRITE_OFF"
    REIMBURSEMENT = "REIMBURSEMENT"


class TransfersCreditCreateTypedDict(TypedDict):
    r"""A transfer using the CREDIT mechanism. Funds are moved from a firm account to a customer's brokerage account"""

    amount: DecimalCreateTypedDict
    r"""A representation of a decimal value, such as 2.5. Clients may convert values into language-native decimal formats, such as Java's [BigDecimal][] or Python's [decimal.Decimal][].

    [BigDecimal]:
    https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/math/BigDecimal.html
    [decimal.Decimal]: https://docs.python.org/3/library/decimal.html
    """
    client_transfer_id: str
    r"""External identifier supplied by the API caller. Each request must have a unique pairing of client_transfer_id and account"""
    type: TransfersCreditCreateType
    r"""The type of the credit being issued"""
    description: NotRequired[str]
    r"""Optional description information that will attach to this transaction"""


class TransfersCreditCreate(BaseModel):
    r"""A transfer using the CREDIT mechanism. Funds are moved from a firm account to a customer's brokerage account"""

    amount: DecimalCreate
    r"""A representation of a decimal value, such as 2.5. Clients may convert values into language-native decimal formats, such as Java's [BigDecimal][] or Python's [decimal.Decimal][].

    [BigDecimal]:
    https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/math/BigDecimal.html
    [decimal.Decimal]: https://docs.python.org/3/library/decimal.html
    """

    client_transfer_id: str
    r"""External identifier supplied by the API caller. Each request must have a unique pairing of client_transfer_id and account"""

    type: Annotated[
        TransfersCreditCreateType, PlainValidator(validate_open_enum(False))
    ]
    r"""The type of the credit being issued"""

    description: Optional[str] = None
    r"""Optional description information that will attach to this transaction"""
