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

"""
paypalserversdk

This file was automatically generated by APIMATIC v3.0 (
 https://www.apimatic.io ).
"""
from paypalserversdk.api_helper import APIHelper


class CheckoutOption(object):

    """Implementation of the 'Checkout Option' model.

    A checkout option as a name-and-value pair.

    Attributes:
        checkout_option_name (str): The checkout option name, such as `color`
            or `texture`.
        checkout_option_value (str): The checkout option value. For example,
            the checkout option `color` might be `blue` or `red` while the
            checkout option `texture` might be `smooth` or `rippled`.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "checkout_option_name": 'checkout_option_name',
        "checkout_option_value": 'checkout_option_value'
    }

    _optionals = [
        'checkout_option_name',
        'checkout_option_value',
    ]

    def __init__(self,
                 checkout_option_name=APIHelper.SKIP,
                 checkout_option_value=APIHelper.SKIP):
        """Constructor for the CheckoutOption class"""

        # Initialize members of the class
        if checkout_option_name is not APIHelper.SKIP:
            self.checkout_option_name = checkout_option_name 
        if checkout_option_value is not APIHelper.SKIP:
            self.checkout_option_value = checkout_option_value 

    @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
        checkout_option_name = dictionary.get("checkout_option_name") if dictionary.get("checkout_option_name") else APIHelper.SKIP
        checkout_option_value = dictionary.get("checkout_option_value") if dictionary.get("checkout_option_value") else APIHelper.SKIP
        # Return an object of this model
        return cls(checkout_option_name,
                   checkout_option_value)

    def __repr__(self):
        return (f'{self.__class__.__name__}('
                f'checkout_option_name={(self.checkout_option_name if hasattr(self, "checkout_option_name") else None)!r}, '
                f'checkout_option_value={(self.checkout_option_value if hasattr(self, "checkout_option_value") else None)!r})')

    def __str__(self):
        return (f'{self.__class__.__name__}('
                f'checkout_option_name={(self.checkout_option_name if hasattr(self, "checkout_option_name") else None)!s}, '
                f'checkout_option_value={(self.checkout_option_value if hasattr(self, "checkout_option_value") else None)!s})')
