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

"""
    apimaticcalculatorlatest

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

import dateutil.parser
import apimaticcalculatorlatest.models.reservationnotificationobject

class RequestToBookRequestModel(object):

    """Implementation of the 'RequestToBookRequestModel' model.

    Model for request to book API request

    Attributes:
        rezcaster_notification_request (Reservationnotificationobject): TODO:
            type description here.
        action (string): RESERVATION_REQUEST
        reservation_id (int): ID of reservation in BookingPal
        message_to_host (string): Message from Guest to host
        expires_at (date): expires time. Date is in format "yyyy-MM-dd"

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "rezcaster_notification_request":'rezcasterNotificationRequest',
        "action":'action',
        "reservation_id":'reservationId',
        "expires_at":'expires_at',
        "message_to_host":'messageToHost'
    }

    def __init__(self,
                 rezcaster_notification_request=None,
                 action=None,
                 reservation_id=None,
                 expires_at=None,
                 message_to_host=None):
        """Constructor for the RequestToBookRequestModel class"""

        # Initialize members of the class
        self.rezcaster_notification_request = rezcaster_notification_request
        self.action = action
        self.reservation_id = reservation_id
        self.message_to_host = message_to_host
        self.expires_at = expires_at


    @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
        rezcaster_notification_request = apimaticcalculatorlatest.models.reservationnotificationobject.Reservationnotificationobject.from_dictionary(dictionary.get('rezcasterNotificationRequest')) if dictionary.get('rezcasterNotificationRequest') else None
        action = dictionary.get('action')
        reservation_id = dictionary.get('reservationId')
        expires_at = dateutil.parser.parse(dictionary.get('expires_at')).date() if dictionary.get('expires_at') else None
        message_to_host = dictionary.get('messageToHost')

        # Return an object of this model
        return cls(rezcaster_notification_request,
                   action,
                   reservation_id,
                   expires_at,
                   message_to_host)


