"""paypalserversdk.

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

# ruff: noqa: E501
from paypalserversdk.api_helper import APIHelper


class P24PaymentObject(object):
    """Implementation of the 'P24 Payment Object' model.

    Information used to pay using P24(Przelewy24).

    Attributes:
        name (str): The full name representation like Mr J Smith.
        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.
        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.
        payment_descriptor (str): P24 generated payment description.
        method_id (str): Numeric identifier of the payment scheme or bank used for
            the payment.
        method_description (str): Friendly name of the payment scheme or bank used
            for the payment.

    """

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

    _optionals = [
        "name",
        "email",
        "country_code",
        "payment_descriptor",
        "method_id",
        "method_description",
    ]

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

    @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
        email =\
            dictionary.get("email")\
            if dictionary.get("email")\
                else APIHelper.SKIP
        country_code =\
            dictionary.get("country_code")\
            if dictionary.get("country_code")\
                else APIHelper.SKIP
        payment_descriptor =\
            dictionary.get("payment_descriptor")\
            if dictionary.get("payment_descriptor")\
                else APIHelper.SKIP
        method_id =\
            dictionary.get("method_id")\
            if dictionary.get("method_id")\
                else APIHelper.SKIP
        method_description =\
            dictionary.get("method_description")\
            if dictionary.get("method_description")\
                else APIHelper.SKIP

        # Return an object of this model
        return cls(name,
                   email,
                   country_code,
                   payment_descriptor,
                   method_id,
                   method_description)

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

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