# This file was auto-generated by Fern from our API Definition.

from ..core.unchecked_base_model import UncheckedBaseModel
import pydantic
import typing
from .payout_status import PayoutStatus
from .money import Money
from .destination import Destination
from .payout_type import PayoutType
from .payout_fee import PayoutFee
from ..core.pydantic_utilities import IS_PYDANTIC_V2


class Payout(UncheckedBaseModel):
    """
    An accounting of the amount owed the seller and record of the actual transfer to their
    external bank account or to the Square balance.
    """

    id: str = pydantic.Field()
    """
    A unique ID for the payout.
    """

    status: typing.Optional[PayoutStatus] = pydantic.Field(default=None)
    """
    Indicates the payout status.
    See [PayoutStatus](#type-payoutstatus) for possible values
    """

    location_id: str = pydantic.Field()
    """
    The ID of the location associated with the payout.
    """

    created_at: typing.Optional[str] = pydantic.Field(default=None)
    """
    The timestamp of when the payout was created and submitted for deposit to the seller's banking destination, in RFC 3339 format.
    """

    updated_at: typing.Optional[str] = pydantic.Field(default=None)
    """
    The timestamp of when the payout was last updated, in RFC 3339 format.
    """

    amount_money: typing.Optional[Money] = pydantic.Field(default=None)
    """
    The amount of money involved in the payout. A positive amount indicates a deposit, and a negative amount indicates a withdrawal. This amount is never zero.
    """

    destination: typing.Optional[Destination] = pydantic.Field(default=None)
    """
    Information about the banking destination (such as a bank account, Square checking account, or debit card)
    against which the payout was made.
    """

    version: typing.Optional[int] = pydantic.Field(default=None)
    """
    The version number, which is incremented each time an update is made to this payout record.
    The version number helps developers receive event notifications or feeds out of order.
    """

    type: typing.Optional[PayoutType] = pydantic.Field(default=None)
    """
    Indicates the payout type.
    See [PayoutType](#type-payouttype) for possible values
    """

    payout_fee: typing.Optional[typing.List[PayoutFee]] = pydantic.Field(default=None)
    """
    A list of transfer fees and any taxes on the fees assessed by Square for this payout.
    """

    arrival_date: typing.Optional[str] = pydantic.Field(default=None)
    """
    The calendar date, in ISO 8601 format (YYYY-MM-DD), when the payout is due to arrive in the seller’s banking destination.
    """

    end_to_end_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    A unique ID for each `Payout` object that might also appear on the seller’s bank statement. You can use this ID to automate the process of reconciling each payout with the corresponding line item on the bank statement.
    """

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow
