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

"""
    apimaticcalculatorlatest

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

import apimaticcalculatorlatest.models.credit_card

class Payment(object):

    """Implementation of the 'Payment' model.

    TODO: type model description here.

    Attributes:
        payment_type (PaymentTypeEnum): TODO: type description here.
        credit_card (CreditCard): TODO: type description here.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "payment_type":'paymentType',
        "credit_card":'creditCard'
    }

    def __init__(self,
                 payment_type=None,
                 credit_card=None):
        """Constructor for the Payment class"""

        # Initialize members of the class
        self.payment_type = payment_type
        self.credit_card = credit_card


    @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 dictionary is None:
            return None

        # Extract variables from the dictionary
        payment_type = dictionary.get('paymentType')
        credit_card = apimaticcalculatorlatest.models.credit_card.CreditCard.from_dictionary(dictionary.get('creditCard')) if dictionary.get('creditCard') else None

        # Return an object of this model
        return cls(payment_type,
                   credit_card)


