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

"""
    apimaticcalculatorlatest

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

import dateutil.parser
import apimaticcalculatorlatest.models.reservation_fee_notification_model
import apimaticcalculatorlatest.models.reservation_tax_notification_model
import apimaticcalculatorlatest.models.reservation_commissions_notification_model
import apimaticcalculatorlatest.models.reservation_rate_notifcation_model

class Reservationnotificationobject(object):

    """Implementation of the 'Reservationnotificationobject' model.

    TODO: type model description here.

    Attributes:
        reservation_id (string): Id of the reservation in BookingPal
        product_id (string): Id of the product in BookingPal
        supplier_id (string): Id of the property manager
        agent_name (string): Agent name/Channel name
        confirmation_id (string): Channel confirmation code
        unique_key (string): Unique code to identify that the request is from
            BookingPal. This value is unique for every PMS (and it will be
            different in different environments).
        new_state (string): Reservation state
        customer_name (string): Guest full name (in format firstName,
            lastName)
        from_date (date): Reservation date from. Date is in format
            "yyyy-MM-dd"
        to_date (date): Reservation date to. Date is in format "yyyy-MM-dd"
        adult (int): number of adults
        child (int): number of children
        address (string): Guest address
        city (string): Guest city
        zip (string): Guest zip code
        country (string): Guest country
        state (string): Guest state
        email (string): Guest email
        phone (string): Guest phone
        notes (string): Guest notes
        credit_card_type (string): Credit card type
        credit_card_number (string): Credit card number
        credit_card_expiration_month (string): Credit card expiration month
        credit_card_expiration_year (string): Credit card expiration yea
        credit_card_cid (string): Credit card cid
        total (float): Best available rate (This is the total value that
            guests will pay, including rate, fees, taxes, and all commissions.
            )
        fees (list of ReservationFeeNotificationModel): List of models
        taxes (list of ReservationTaxNotificationModel): List of models
        commission (ReservationCommissionsNotificationModel): TODO: type
            description here.
        rate (ReservationRateNotifcationModel): TODO: type description here.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "reservation_id":'reservationId',
        "product_id":'productId',
        "supplier_id":'supplierId',
        "agent_name":'agentName',
        "confirmation_id":'confirmationId',
        "unique_key":'uniqueKey',
        "new_state":'newState',
        "customer_name":'customerName',
        "from_date":'fromDate',
        "to_date":'toDate',
        "adult":'adult',
        "child":'child',
        "email":'email',
        "total":'total',
        "fees":'fees',
        "taxes":'taxes',
        "commission":'commission',
        "rate":'rate',
        "address":'address',
        "city":'city',
        "zip":'zip',
        "country":'country',
        "state":'state',
        "phone":'phone',
        "notes":'notes',
        "credit_card_type":'creditCardType',
        "credit_card_number":'creditCardNumber',
        "credit_card_expiration_month":'creditCardExpirationMonth',
        "credit_card_expiration_year":'creditCardExpirationYear',
        "credit_card_cid":'creditCardCid'
    }

    def __init__(self,
                 reservation_id=None,
                 product_id=None,
                 supplier_id=None,
                 agent_name=None,
                 confirmation_id=None,
                 unique_key=None,
                 new_state=None,
                 customer_name=None,
                 from_date=None,
                 to_date=None,
                 adult=None,
                 child=None,
                 email=None,
                 total=None,
                 fees=None,
                 taxes=None,
                 commission=None,
                 rate=None,
                 address=None,
                 city=None,
                 zip=None,
                 country=None,
                 state=None,
                 phone=None,
                 notes=None,
                 credit_card_type=None,
                 credit_card_number=None,
                 credit_card_expiration_month=None,
                 credit_card_expiration_year=None,
                 credit_card_cid=None):
        """Constructor for the Reservationnotificationobject class"""

        # Initialize members of the class
        self.reservation_id = reservation_id
        self.product_id = product_id
        self.supplier_id = supplier_id
        self.agent_name = agent_name
        self.confirmation_id = confirmation_id
        self.unique_key = unique_key
        self.new_state = new_state
        self.customer_name = customer_name
        self.from_date = from_date
        self.to_date = to_date
        self.adult = adult
        self.child = child
        self.address = address
        self.city = city
        self.zip = zip
        self.country = country
        self.state = state
        self.email = email
        self.phone = phone
        self.notes = notes
        self.credit_card_type = credit_card_type
        self.credit_card_number = credit_card_number
        self.credit_card_expiration_month = credit_card_expiration_month
        self.credit_card_expiration_year = credit_card_expiration_year
        self.credit_card_cid = credit_card_cid
        self.total = total
        self.fees = fees
        self.taxes = taxes
        self.commission = commission
        self.rate = rate


    @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
        reservation_id = dictionary.get('reservationId')
        product_id = dictionary.get('productId')
        supplier_id = dictionary.get('supplierId')
        agent_name = dictionary.get('agentName')
        confirmation_id = dictionary.get('confirmationId')
        unique_key = dictionary.get('uniqueKey')
        new_state = dictionary.get('newState')
        customer_name = dictionary.get('customerName')
        from_date = dateutil.parser.parse(dictionary.get('fromDate')).date() if dictionary.get('fromDate') else None
        to_date = dateutil.parser.parse(dictionary.get('toDate')).date() if dictionary.get('toDate') else None
        adult = dictionary.get('adult')
        child = dictionary.get('child')
        email = dictionary.get('email')
        total = dictionary.get('total')
        fees = None
        if dictionary.get('fees') != None:
            fees = list()
            for structure in dictionary.get('fees'):
                fees.append(apimaticcalculatorlatest.models.reservation_fee_notification_model.ReservationFeeNotificationModel.from_dictionary(structure))
        taxes = None
        if dictionary.get('taxes') != None:
            taxes = list()
            for structure in dictionary.get('taxes'):
                taxes.append(apimaticcalculatorlatest.models.reservation_tax_notification_model.ReservationTaxNotificationModel.from_dictionary(structure))
        commission = apimaticcalculatorlatest.models.reservation_commissions_notification_model.ReservationCommissionsNotificationModel.from_dictionary(dictionary.get('commission')) if dictionary.get('commission') else None
        rate = apimaticcalculatorlatest.models.reservation_rate_notifcation_model.ReservationRateNotifcationModel.from_dictionary(dictionary.get('rate')) if dictionary.get('rate') else None
        address = dictionary.get('address')
        city = dictionary.get('city')
        zip = dictionary.get('zip')
        country = dictionary.get('country')
        state = dictionary.get('state')
        phone = dictionary.get('phone')
        notes = dictionary.get('notes')
        credit_card_type = dictionary.get('creditCardType')
        credit_card_number = dictionary.get('creditCardNumber')
        credit_card_expiration_month = dictionary.get('creditCardExpirationMonth')
        credit_card_expiration_year = dictionary.get('creditCardExpirationYear')
        credit_card_cid = dictionary.get('creditCardCid')

        # Return an object of this model
        return cls(reservation_id,
                   product_id,
                   supplier_id,
                   agent_name,
                   confirmation_id,
                   unique_key,
                   new_state,
                   customer_name,
                   from_date,
                   to_date,
                   adult,
                   child,
                   email,
                   total,
                   fees,
                   taxes,
                   commission,
                   rate,
                   address,
                   city,
                   zip,
                   country,
                   state,
                   phone,
                   notes,
                   credit_card_type,
                   credit_card_number,
                   credit_card_expiration_month,
                   credit_card_expiration_year,
                   credit_card_cid)


