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

import datetime as dt
import typing

import pydantic
import typing_extensions
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from ..core.serialization import FieldMetadata
from .batch_number import BatchNumber
from .bill_data import BillData
from .category import Category
from .created_at import CreatedAt
from .deposit_date import DepositDate
from .expected_deposit_date import ExpectedDepositDate
from .external_paypoint_id import ExternalPaypointId
from .maskedaccount import Maskedaccount
from .netamountnullable import Netamountnullable
from .order_id import OrderId
from .org_parent_name import OrgParentName
from .query_payment_data import QueryPaymentData
from .query_response_data import QueryResponseData
from .query_transaction_events import QueryTransactionEvents
from .query_transaction_payor_data import QueryTransactionPayorData
from .settlement_status import SettlementStatus
from .source import Source
from .trans_status import TransStatus
from .transaction_time import TransactionTime


class QueryResponseSettlementsRecordsItem(UniversalBaseModel):
    batch_amount: typing_extensions.Annotated[typing.Optional[float], FieldMetadata(alias="BatchAmount")] = (
        pydantic.Field(default=None)
    )
    """
    The batch amount.
    """

    batch_number: typing_extensions.Annotated[typing.Optional[BatchNumber], FieldMetadata(alias="BatchNumber")] = None
    category: typing_extensions.Annotated[typing.Optional[Category], FieldMetadata(alias="Category")] = None
    created_at: typing_extensions.Annotated[typing.Optional[CreatedAt], FieldMetadata(alias="CreatedAt")] = None
    customer: typing_extensions.Annotated[
        typing.Optional[QueryTransactionPayorData], FieldMetadata(alias="Customer")
    ] = None
    deposit_date: typing_extensions.Annotated[typing.Optional[DepositDate], FieldMetadata(alias="DepositDate")] = None
    expected_deposit_date: typing_extensions.Annotated[
        typing.Optional[ExpectedDepositDate], FieldMetadata(alias="ExpectedDepositDate")
    ] = None
    external_paypoint_id: typing_extensions.Annotated[
        typing.Optional[ExternalPaypointId], FieldMetadata(alias="externalPaypointID")
    ] = None
    gateway_trans_id: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="GatewayTransId")] = (
        pydantic.Field(default=None)
    )
    """
    Internal identifier used for processing.
    """

    id: typing_extensions.Annotated[typing.Optional[int], FieldMetadata(alias="Id")] = None
    invoice_data: typing_extensions.Annotated[typing.Optional[BillData], FieldMetadata(alias="invoiceData")] = None
    is_hold: typing_extensions.Annotated[typing.Optional[int], FieldMetadata(alias="isHold")] = pydantic.Field(
        default=None
    )
    """
    
    Describes whether the transaction is being held or not.
    
    1 - Transaction is held
    
    0 - Transaction isn't being held
    """

    masked_account: typing_extensions.Annotated[
        typing.Optional[Maskedaccount], FieldMetadata(alias="MaskedAccount")
    ] = None
    method: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="Method")] = pydantic.Field(
        default=None
    )
    """
    The payment method.
    """

    net_amount: typing_extensions.Annotated[typing.Optional[Netamountnullable], FieldMetadata(alias="NetAmount")] = (
        pydantic.Field(default=None)
    )
    """
    Net amount paid.
    """

    operation: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="Operation")] = pydantic.Field(
        default=None
    )
    """
    The operation performed.
    """

    order_id: typing_extensions.Annotated[typing.Optional[OrderId], FieldMetadata(alias="OrderId")] = None
    parent_org_name: typing_extensions.Annotated[
        typing.Optional[OrgParentName], FieldMetadata(alias="ParentOrgName")
    ] = None
    payment_data: typing_extensions.Annotated[typing.Optional[QueryPaymentData], FieldMetadata(alias="PaymentData")] = (
        None
    )
    payment_trans_id: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="PaymentTransId")] = (
        pydantic.Field(default=None)
    )
    """
    The transaction ID for the payment.
    """

    payment_trans_status: typing_extensions.Annotated[
        typing.Optional[TransStatus], FieldMetadata(alias="PaymentTransStatus")
    ] = None
    paypoint_dbaname: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="PaypointDbaname")] = (
        pydantic.Field(default=None)
    )
    """
    Paypoint DBA name.
    """

    paypoint_entryname: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="PaypointEntryname")] = (
        pydantic.Field(default=None)
    )
    """
    Paypoint entryname.
    """

    paypoint_legalname: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="PaypointLegalname")] = (
        pydantic.Field(default=None)
    )
    """
    Paypoint legal name.
    """

    response_data: typing_extensions.Annotated[
        typing.Optional[QueryResponseData], FieldMetadata(alias="ResponseData")
    ] = None
    schedule_reference: typing_extensions.Annotated[typing.Optional[int], FieldMetadata(alias="ScheduleReference")] = (
        pydantic.Field(default=None)
    )
    """
    Reference to the subscription originating the transaction.
    """

    settled_amount: typing_extensions.Annotated[typing.Optional[float], FieldMetadata(alias="SettledAmount")] = (
        pydantic.Field(default=None)
    )
    """
    The transaction amount.
    """

    settlement_date: typing_extensions.Annotated[
        typing.Optional[dt.datetime], FieldMetadata(alias="SettlementDate")
    ] = pydantic.Field(default=None)
    """
     
    """

    source: typing_extensions.Annotated[typing.Optional[Source], FieldMetadata(alias="Source")] = None
    status: typing_extensions.Annotated[typing.Optional[SettlementStatus], FieldMetadata(alias="Status")] = None
    transaction_events: typing_extensions.Annotated[
        typing.Optional[typing.List[QueryTransactionEvents]], FieldMetadata(alias="TransactionEvents")
    ] = pydantic.Field(default=None)
    """
    Events associated with this transaction.
    """

    transaction_time: typing_extensions.Annotated[
        typing.Optional[TransactionTime], FieldMetadata(alias="TransactionTime")
    ] = None
    trans_method: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="TransMethod")] = (
        pydantic.Field(default=None)
    )
    """
    Payment method used: card or ach.
    """

    type: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="Type")] = pydantic.Field(default=None)
    """
    The transaction type: credit or debit.
    """

    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
