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

from ..core.unchecked_base_model import UncheckedBaseModel
import typing
import pydantic
from .currency import Currency
from ..core.pydantic_utilities import IS_PYDANTIC_V2


class Money(UncheckedBaseModel):
    """
    Represents an amount of money. `Money` fields can be signed or unsigned.
    Fields that do not explicitly define whether they are signed or unsigned are
    considered unsigned and can only hold positive amounts. For signed fields, the
    sign of the value indicates the purpose of the money transfer. See
    [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts)
    for more information.
    """

    amount: typing.Optional[int] = pydantic.Field(default=None)
    """
    The amount of money, in the smallest denomination of the currency
    indicated by `currency`. For example, when `currency` is `USD`, `amount` is
    in cents. Monetary amounts can be positive or negative. See the specific
    field description to determine the meaning of the sign in a particular case.
    """

    currency: typing.Optional[Currency] = pydantic.Field(default=None)
    """
    The type of currency, in __ISO 4217 format__. For example, the currency
    code for US dollars is `USD`.
    
    See [Currency](entity:Currency) for possible values.
    See [Currency](#type-currency) for possible values
    """

    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
