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

"""
pqapiv2

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


class Expiration(object):

    """Implementation of the '_expiration' model.

    Date and time the object will expire

    Attributes:
        expires (datetime): Quote expiration, ISO-8601 format, UTC by default
            unless overridden.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "expires": 'expires'
    }

    def __init__(self,
                 expires=None):
        """Constructor for the Expiration class"""

        # Initialize members of the class
        self.expires = APIHelper.RFC3339DateTime(expires) if expires else None

    @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
        expires = APIHelper.RFC3339DateTime.from_value(dictionary.get("expires")).datetime if dictionary.get("expires") else None

        # Return an object of this model
        return cls(expires)
