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

"""
billbeeapi

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


class BillbeeInterfacesBillbeeAPIModelsOrderPayment(object):

    """Implementation of the 'Billbee.Interfaces.BillbeeAPI.Models.OrderPayment' model.

    TODO: type model description here.

    Attributes:
        billbee_id (long|int): TODO: type description here.
        transaction_id (string): TODO: type description here.
        pay_date (datetime): TODO: type description here.
        payment_type (int): TODO: type description here.
        source_technology (string): TODO: type description here.
        source_text (string): TODO: type description here.
        pay_value (float): TODO: type description here.
        purpose (string): TODO: type description here.
        name (string): TODO: type description here.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "billbee_id": 'BillbeeId',
        "transaction_id": 'TransactionId',
        "pay_date": 'PayDate',
        "payment_type": 'PaymentType',
        "source_technology": 'SourceTechnology',
        "source_text": 'SourceText',
        "pay_value": 'PayValue',
        "purpose": 'Purpose',
        "name": 'Name'
    }

    def __init__(self,
                 billbee_id=None,
                 transaction_id=None,
                 pay_date=None,
                 payment_type=None,
                 source_technology=None,
                 source_text=None,
                 pay_value=None,
                 purpose=None,
                 name=None):
        """Constructor for the BillbeeInterfacesBillbeeAPIModelsOrderPayment class"""

        # Initialize members of the class
        self.billbee_id = billbee_id
        self.transaction_id = transaction_id
        self.pay_date = APIHelper.RFC3339DateTime(pay_date) if pay_date else None
        self.payment_type = payment_type
        self.source_technology = source_technology
        self.source_text = source_text
        self.pay_value = pay_value
        self.purpose = purpose
        self.name = name

    @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
        billbee_id = dictionary.get('BillbeeId')
        transaction_id = dictionary.get('TransactionId')
        pay_date = APIHelper.RFC3339DateTime.from_value(dictionary.get("PayDate")).datetime if dictionary.get("PayDate") else None
        payment_type = dictionary.get('PaymentType')
        source_technology = dictionary.get('SourceTechnology')
        source_text = dictionary.get('SourceText')
        pay_value = dictionary.get('PayValue')
        purpose = dictionary.get('Purpose')
        name = dictionary.get('Name')

        # Return an object of this model
        return cls(billbee_id,
                   transaction_id,
                   pay_date,
                   payment_type,
                   source_technology,
                   source_text,
                   pay_value,
                   purpose,
                   name)
