# coding: utf-8

"""
    Payment API

    No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

    The version of the OpenAPI document: 0.1.0
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""  # noqa: E501


from __future__ import annotations
import pprint
import re  # noqa: F401
import json

from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self


class MinAmountReq(BaseModel):
    """
    Get the minimum payment amount for a specific currency pair. https://documenter.getpostman.com/view/7907941/2s93JusNJt#ce3fe3a3-00cd-4df2-bfba-641fde741da7  You can provide both currencies in the pair or just currency_from. If only currency_from is provided, the minimum payment amount will be calculated for currency_from and the default currency specified in Payment Settings.  You can specify a fiat currency in currency_from to calculate the minimum payment in that fiat currency.  The fiat_equivalent field can be added to get the fiat equivalent of the minimum amount.  The is_fixed_rate and is_fee_paid_by_user parameters allow you to see current minimal amounts for corresponding flows, which may differ from the standard flow.  For multiple outcome wallets, the minimum amount is calculated based on the payment routing logic.
    """  # noqa: E501

    currency_from: StrictStr = Field(description="Payin currency")
    currency_to: Optional[StrictStr] = None
    fiat_equivalent: Optional[StrictStr] = None
    is_fixed_rate: Optional[StrictBool] = None
    is_fee_paid_by_user: Optional[StrictBool] = None
    __properties: ClassVar[List[str]] = [
        "currency_from",
        "currency_to",
        "fiat_equivalent",
        "is_fixed_rate",
        "is_fee_paid_by_user",
    ]

    model_config = ConfigDict(
        populate_by_name=True,
        validate_assignment=True,
        protected_namespaces=(),
    )

    def to_str(self) -> str:
        """Returns the string representation of the model using alias"""
        return pprint.pformat(self.model_dump(by_alias=True))

    def to_json(self) -> str:
        """Returns the JSON representation of the model using alias"""
        # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
        return json.dumps(self.to_dict())

    @classmethod
    def from_json(cls, json_str: str) -> Optional[Self]:
        """Create an instance of MinAmountReq from a JSON string"""
        return cls.from_dict(json.loads(json_str))

    def to_dict(self) -> Dict[str, Any]:
        """Return the dictionary representation of the model using alias.

        This has the following differences from calling pydantic's
        `self.model_dump(by_alias=True)`:

        * `None` is only added to the output dict for nullable fields that
          were set at model initialization. Other fields with value `None`
          are ignored.
        """
        excluded_fields: Set[str] = set([])

        _dict = self.model_dump(
            by_alias=True,
            exclude=excluded_fields,
            exclude_none=True,
        )
        # set to None if currency_to (nullable) is None
        # and model_fields_set contains the field
        if self.currency_to is None and "currency_to" in self.model_fields_set:
            _dict["currency_to"] = None

        # set to None if fiat_equivalent (nullable) is None
        # and model_fields_set contains the field
        if self.fiat_equivalent is None and "fiat_equivalent" in self.model_fields_set:
            _dict["fiat_equivalent"] = None

        # set to None if is_fixed_rate (nullable) is None
        # and model_fields_set contains the field
        if self.is_fixed_rate is None and "is_fixed_rate" in self.model_fields_set:
            _dict["is_fixed_rate"] = None

        # set to None if is_fee_paid_by_user (nullable) is None
        # and model_fields_set contains the field
        if (
            self.is_fee_paid_by_user is None
            and "is_fee_paid_by_user" in self.model_fields_set
        ):
            _dict["is_fee_paid_by_user"] = None

        return _dict

    @classmethod
    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
        """Create an instance of MinAmountReq from a dict"""
        if obj is None:
            return None

        if not isinstance(obj, dict):
            return cls.model_validate(obj)

        _obj = cls.model_validate(
            {
                "currency_from": obj.get("currency_from"),
                "currency_to": obj.get("currency_to"),
                "fiat_equivalent": obj.get("fiat_equivalent"),
                "is_fixed_rate": obj.get("is_fixed_rate"),
                "is_fee_paid_by_user": obj.get("is_fee_paid_by_user"),
            }
        )
        return _obj
