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

"""
    apimaticcalculatorlatest

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


class ReservationpushResponse(object):

    """Implementation of the 'ReservationpushResponse' model.

    This is response which the BookingPal expect to get on from PMS on push
    POST request for create/cancel reservation

    Attributes:
        alt_id (string): Id of reservation in your system
        is_error (bool): Did you have error during processing of request
            (true) or not (false)
        code (string): Code of message
        message (string): Text info message. If you have any error please put
            here detail message.
        transaction_state (string): This field should be returned only if you
            are processing payment. With information did you process payment
            or not. Allowed values [Accepted, Failed].

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "alt_id":'altId',
        "is_error":'is_error',
        "code":'code',
        "message":'message',
        "transaction_state":'transactionState'
    }

    def __init__(self,
                 alt_id=None,
                 is_error=False,
                 code=None,
                 message=None,
                 transaction_state=None):
        """Constructor for the ReservationpushResponse class"""

        # Initialize members of the class
        self.alt_id = alt_id
        self.is_error = is_error
        self.code = code
        self.message = message
        self.transaction_state = transaction_state


    @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
        alt_id = dictionary.get('altId')
        is_error = dictionary.get("is_error") if dictionary.get("is_error") else False
        code = dictionary.get('code')
        message = dictionary.get('message')
        transaction_state = dictionary.get('transactionState')

        # Return an object of this model
        return cls(alt_id,
                   is_error,
                   code,
                   message,
                   transaction_state)


