"""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.blik_one_click_payment_object import (
    BlikOneClickPaymentObject,
)


class BlikPaymentObject(object):
    """Implementation of the 'BLIK Payment Object' model.

    Information used to pay using BLIK.

    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.
        email (str): The internationalized email address. Note: Up to 64 characters
            are allowed before and 255 characters are allowed after the @ sign.
            However, the generally accepted maximum length for an email address is
            254 characters. The pattern verifies that an unquoted @ sign exists.
        one_click (BlikOneClickPaymentObject): Information used to pay using BLIK
            one-click flow.

    """

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

    _optionals = [
        "name",
        "country_code",
        "email",
        "one_click",
    ]

    def __init__(
        self,
        name=APIHelper.SKIP,
        country_code=APIHelper.SKIP,
        email=APIHelper.SKIP,
        one_click=APIHelper.SKIP):
        """Initialize a BlikPaymentObject instance."""
        # Initialize members of the class
        if name is not APIHelper.SKIP:
            self.name = name
        if country_code is not APIHelper.SKIP:
            self.country_code = country_code
        if email is not APIHelper.SKIP:
            self.email = email
        if one_click is not APIHelper.SKIP:
            self.one_click = one_click

    @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 APIHelper.SKIP
        country_code =\
            dictionary.get("country_code")\
            if dictionary.get("country_code")\
                else APIHelper.SKIP
        email =\
            dictionary.get("email")\
            if dictionary.get("email")\
                else APIHelper.SKIP
        one_click =\
            BlikOneClickPaymentObject.from_dictionary(
                dictionary.get("one_click"))\
                if "one_click" in dictionary.keys()\
                else APIHelper.SKIP

        # Return an object of this model
        return cls(name,
                   country_code,
                   email,
                   one_click)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _name=(
            self.name
            if hasattr(self, "name")
            else None
        )
        _country_code=(
            self.country_code
            if hasattr(self, "country_code")
            else None
        )
        _email=(
            self.email
            if hasattr(self, "email")
            else None
        )
        _one_click=(
            self.one_click
            if hasattr(self, "one_click")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"name={_name!r}, "
            f"country_code={_country_code!r}, "
            f"email={_email!r}, "
            f"one_click={_one_click!r}, "
            f")"
        )

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