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

import typing

import pydantic
import typing_extensions
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from ..core.serialization import FieldMetadata
from .page_identifier import PageIdentifier


class QueryResponseSettlementsSummary(UniversalBaseModel):
    held_amount: typing_extensions.Annotated[typing.Optional[float], FieldMetadata(alias="heldAmount")] = (
        pydantic.Field(default=None)
    )
    """
    Funds being held for fraud or risk concerns.
    """

    pageidentifier: typing.Optional[PageIdentifier] = None
    page_size: typing_extensions.Annotated[typing.Optional[int], FieldMetadata(alias="pageSize")] = pydantic.Field(
        default=None
    )
    """
    Number of records per page.
    """

    refunds: typing.Optional[float] = pydantic.Field(default=None)
    """
    Total refunds deducted from the transfer.
    """

    service_fees: typing_extensions.Annotated[typing.Optional[float], FieldMetadata(alias="serviceFees")] = (
        pydantic.Field(default=None)
    )
    """
    Service fees are any pass-through fees charged to the customer at the time of payment. These aren't transferred to the merchant when the batch is transferred and funded.
    """

    total_amount: typing_extensions.Annotated[typing.Optional[float], FieldMetadata(alias="totalAmount")] = (
        pydantic.Field(default=None)
    )
    """
    The total sum of the settlements in the response.
    """

    total_net_amount: typing_extensions.Annotated[typing.Optional[float], FieldMetadata(alias="totalNetAmount")] = (
        pydantic.Field(default=None)
    )
    """
    The total sum of the settlements in the response.
    """

    total_pages: typing_extensions.Annotated[typing.Optional[int], FieldMetadata(alias="totalPages")] = pydantic.Field(
        default=None
    )
    """
    Number of pages in the response.
    """

    total_records: typing_extensions.Annotated[typing.Optional[int], FieldMetadata(alias="totalRecords")] = (
        pydantic.Field(default=None)
    )
    """
    Number of records in the response.
    """

    transfer_amount: typing_extensions.Annotated[typing.Optional[float], FieldMetadata(alias="transferAmount")] = (
        pydantic.Field(default=None)
    )
    """
    The transfer amount is the net batch amount plus or minus any returns, refunds, billing and fees items, chargebacks, adjustments, and third party payments. This is the amount from the batch that's transferred to the merchant bank account.
    """

    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
