# -*- coding: utf-8 -*-

"""
paypalserversdk

This file was automatically generated by APIMATIC v3.0 (
 https://www.apimatic.io ).
"""
from paypalserversdk.api_helper import APIHelper
from paypalserversdk.models.blik_experience_context import BlikExperienceContext
from paypalserversdk.models.blik_level_0_payment_object import BlikLevel0PaymentObject
from paypalserversdk.models.blik_one_click_payment_request import BlikOneClickPaymentRequest


class BlikPaymentRequest(object):

    """Implementation of the 'BLIK Payment Request' model.

    Information needed 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.
        experience_context (BlikExperienceContext): Customizes the payer
            experience during the approval process for the BLIK payment.
        level_0 (BlikLevel0PaymentObject): Information used to pay using BLIK
            level_0 flow.
        one_click (BlikOneClickPaymentRequest): 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',
        "experience_context": 'experience_context',
        "level_0": 'level_0',
        "one_click": 'one_click'
    }

    _optionals = [
        'email',
        'experience_context',
        'level_0',
        'one_click',
    ]

    def __init__(self,
                 name=None,
                 country_code=None,
                 email=APIHelper.SKIP,
                 experience_context=APIHelper.SKIP,
                 level_0=APIHelper.SKIP,
                 one_click=APIHelper.SKIP):
        """Constructor for the BlikPaymentRequest class"""

        # Initialize members of the class
        self.name = name 
        self.country_code = country_code 
        if email is not APIHelper.SKIP:
            self.email = email 
        if experience_context is not APIHelper.SKIP:
            self.experience_context = experience_context 
        if level_0 is not APIHelper.SKIP:
            self.level_0 = level_0 
        if one_click is not APIHelper.SKIP:
            self.one_click = one_click 

    @classmethod
    def from_dictionary(cls,
                        dictionary):
        """Creates 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
        email = dictionary.get("email") if dictionary.get("email") else APIHelper.SKIP
        experience_context = BlikExperienceContext.from_dictionary(dictionary.get('experience_context')) if 'experience_context' in dictionary.keys() else APIHelper.SKIP
        level_0 = BlikLevel0PaymentObject.from_dictionary(dictionary.get('level_0')) if 'level_0' in dictionary.keys() else APIHelper.SKIP
        one_click = BlikOneClickPaymentRequest.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,
                   experience_context,
                   level_0,
                   one_click)

    def __repr__(self):
        return (f'{self.__class__.__name__}('
                f'name={self.name!r}, '
                f'country_code={self.country_code!r}, '
                f'email={(self.email if hasattr(self, "email") else None)!r}, '
                f'experience_context={(self.experience_context if hasattr(self, "experience_context") else None)!r}, '
                f'level_0={(self.level_0 if hasattr(self, "level_0") else None)!r}, '
                f'one_click={(self.one_click if hasattr(self, "one_click") else None)!r})')

    def __str__(self):
        return (f'{self.__class__.__name__}('
                f'name={self.name!s}, '
                f'country_code={self.country_code!s}, '
                f'email={(self.email if hasattr(self, "email") else None)!s}, '
                f'experience_context={(self.experience_context if hasattr(self, "experience_context") else None)!s}, '
                f'level_0={(self.level_0 if hasattr(self, "level_0") else None)!s}, '
                f'one_click={(self.one_click if hasattr(self, "one_click") else None)!s})')
