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

from __future__ import annotations
from moovio_sdk.models.components import incurredfee as components_incurredfee
from moovio_sdk.types import BaseModel, UNSET_SENTINEL
from moovio_sdk.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata
import pydantic
from pydantic import model_serializer
from typing import Dict, List, Optional
from typing_extensions import Annotated, NotRequired, TypedDict


class ListFeeRevenueRequestTypedDict(TypedDict):
    account_id: str
    r"""The Partner's AccountID."""
    skip: NotRequired[int]
    count: NotRequired[int]
    transfer_id: NotRequired[str]
    r"""Optional transfer ID to filter the results by."""
    dispute_id: NotRequired[str]
    r"""Optional dispute ID to filter the results by."""
    residual_id: NotRequired[str]
    r"""Optional residual ID to filter the results by."""
    start_date_time: NotRequired[str]
    r"""Optional date-time to inclusively filter all fees created after this date-time."""
    end_date_time: NotRequired[str]
    r"""Optional date-time to exclusively filter all fees created before this date-time."""


class ListFeeRevenueRequest(BaseModel):
    account_id: Annotated[
        str,
        pydantic.Field(alias="accountID"),
        FieldMetadata(path=PathParamMetadata(style="simple", explode=False)),
    ]
    r"""The Partner's AccountID."""

    skip: Annotated[
        Optional[int],
        FieldMetadata(query=QueryParamMetadata(style="form", explode=False)),
    ] = None

    count: Annotated[
        Optional[int],
        FieldMetadata(query=QueryParamMetadata(style="form", explode=False)),
    ] = None

    transfer_id: Annotated[
        Optional[str],
        pydantic.Field(alias="transferID"),
        FieldMetadata(query=QueryParamMetadata(style="form", explode=False)),
    ] = None
    r"""Optional transfer ID to filter the results by."""

    dispute_id: Annotated[
        Optional[str],
        pydantic.Field(alias="disputeID"),
        FieldMetadata(query=QueryParamMetadata(style="form", explode=False)),
    ] = None
    r"""Optional dispute ID to filter the results by."""

    residual_id: Annotated[
        Optional[str],
        pydantic.Field(alias="residualID"),
        FieldMetadata(query=QueryParamMetadata(style="form", explode=False)),
    ] = None
    r"""Optional residual ID to filter the results by."""

    start_date_time: Annotated[
        Optional[str],
        pydantic.Field(alias="startDateTime"),
        FieldMetadata(query=QueryParamMetadata(style="form", explode=False)),
    ] = None
    r"""Optional date-time to inclusively filter all fees created after this date-time."""

    end_date_time: Annotated[
        Optional[str],
        pydantic.Field(alias="endDateTime"),
        FieldMetadata(query=QueryParamMetadata(style="form", explode=False)),
    ] = None
    r"""Optional date-time to exclusively filter all fees created before this date-time."""

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = set(
            [
                "skip",
                "count",
                "transferID",
                "disputeID",
                "residualID",
                "startDateTime",
                "endDateTime",
            ]
        )
        serialized = handler(self)
        m = {}

        for n, f in type(self).model_fields.items():
            k = f.alias or n
            val = serialized.get(k, serialized.get(n))

            if val != UNSET_SENTINEL:
                if val is not None or k not in optional_fields:
                    m[k] = val

        return m


class ListFeeRevenueResponseTypedDict(TypedDict):
    headers: Dict[str, List[str]]
    result: List[components_incurredfee.IncurredFeeTypedDict]


class ListFeeRevenueResponse(BaseModel):
    headers: Dict[str, List[str]]

    result: List[components_incurredfee.IncurredFee]
