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

import datetime as dt
import typing

from ....core.datetime_utils import serialize_datetime
from ...invoice_types.types.payment_destination_options import PaymentDestinationOptions
from ...payment_method_types.types.currency_code import CurrencyCode
from ...payment_method_types.types.payment_method_id import PaymentMethodId

try:
    import pydantic.v1 as pydantic  # type: ignore
except ImportError:
    import pydantic  # type: ignore


class CalculateFeesRequest(pydantic.BaseModel):
    amount: float = pydantic.Field(
        description="Total amount in major units. If the entered amount has more decimal places than the currency supports, trailing decimals will be truncated."
    )
    currency: typing.Optional[CurrencyCode] = pydantic.Field(
        default=None, description="Currency code for the amount. Defaults to USD."
    )
    payment_source_id: PaymentMethodId = pydantic.Field(alias="paymentSourceId", description="ID of payment source.")
    payment_destination_id: PaymentMethodId = pydantic.Field(
        alias="paymentDestinationId", description="ID of payment destination."
    )
    payment_destination_options: typing.Optional[PaymentDestinationOptions] = pydantic.Field(
        alias="paymentDestinationOptions",
        default=None,
        description="Options for the payment destination. Depending on the payment destination, this may include things such as check delivery method.",
    )

    def json(self, **kwargs: typing.Any) -> str:
        kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
        return super().json(**kwargs_with_defaults)

    def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
        kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
        return super().dict(**kwargs_with_defaults)

    class Config:
        frozen = True
        smart_union = True
        allow_population_by_field_name = True
        json_encoders = {dt.datetime: serialize_datetime}
