"""paypalserversdk.

This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
"""

# ruff: noqa: E501
from paypalserversdk.api_helper import APIHelper
from paypalserversdk.models.experience_context import (
    ExperienceContext,
)


class IdealPaymentRequest(object):
    """Implementation of the 'iDEAL Payment Request' model.

    Information needed to pay using iDEAL.

    Attributes:
        name (str): The full name representation like Mr J Smith.
        country_code (str): The [two-character ISO 3166-1
            code](/api/rest/reference/country-codes/) that identifies the country or
            region. Note: The country code for Great Britain is GB and not UK as used
            in the top-level domain names for that country. Use the `C2` country code
            for China worldwide for comparable uncontrolled price (CUP) method, bank
            card, and cross-border transactions.
        bic (str): The business identification code (BIC). In payments systems, a BIC
            is used to identify a specific business, most commonly a bank.
        experience_context (ExperienceContext): Customizes the payer experience
            during the approval process for the payment.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "name": "name",
        "country_code": "country_code",
        "bic": "bic",
        "experience_context": "experience_context",
    }

    _optionals = [
        "bic",
        "experience_context",
    ]

    def __init__(
        self,
        name=None,
        country_code=None,
        bic=APIHelper.SKIP,
        experience_context=APIHelper.SKIP):
        """Initialize a IdealPaymentRequest instance."""
        # Initialize members of the class
        self.name = name
        self.country_code = country_code
        if bic is not APIHelper.SKIP:
            self.bic = bic
        if experience_context is not APIHelper.SKIP:
            self.experience_context = experience_context

    @classmethod
    def from_dictionary(cls,
                        dictionary):
        """Create an instance of this model from a dictionary

        Args:
            dictionary (dictionary): A dictionary representation of the object
            as obtained from the deserialization of the server's response. The
            keys MUST match property names in the API description.

        Returns:
            object: An instance of this structure class.

        """
        if not isinstance(dictionary, dict) or dictionary is None:
            return None

        # Extract variables from the dictionary
        name =\
            dictionary.get("name")\
            if dictionary.get("name")\
                else None
        country_code =\
            dictionary.get("country_code")\
            if dictionary.get("country_code")\
                else None
        bic =\
            dictionary.get("bic")\
            if dictionary.get("bic")\
                else APIHelper.SKIP
        experience_context =\
            ExperienceContext.from_dictionary(
                dictionary.get("experience_context"))\
                if "experience_context" in dictionary.keys()\
                else APIHelper.SKIP

        # Return an object of this model
        return cls(name,
                   country_code,
                   bic,
                   experience_context)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _name=self.name
        _country_code=self.country_code
        _bic=(
            self.bic
            if hasattr(self, "bic")
            else None
        )
        _experience_context=(
            self.experience_context
            if hasattr(self, "experience_context")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"name={_name!r}, "
            f"country_code={_country_code!r}, "
            f"bic={_bic!r}, "
            f"experience_context={_experience_context!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _name=self.name
        _country_code=self.country_code
        _bic=(
            self.bic
            if hasattr(self, "bic")
            else None
        )
        _experience_context=(
            self.experience_context
            if hasattr(self, "experience_context")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"name={_name!s}, "
            f"country_code={_country_code!s}, "
            f"bic={_bic!s}, "
            f"experience_context={_experience_context!s}, "
            f")"
        )
