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

"""
pqapiv2

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


class NotBeforeOrAfter(object):

    """Implementation of the '_notBeforeOrAfter' model.

    TODO: type model description here.

    Attributes:
        not_before (datetime): Transfer is scheduled and will not process
            before this time.
        not_after (datetime): Transfer expires if not completed prior to this
            time.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "not_before": 'notBefore',
        "not_after": 'notAfter'
    }

    def __init__(self,
                 not_before=None,
                 not_after=None):
        """Constructor for the NotBeforeOrAfter class"""

        # Initialize members of the class
        self.not_before = APIHelper.RFC3339DateTime(not_before) if not_before else None
        self.not_after = APIHelper.RFC3339DateTime(not_after) if not_after 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
        not_before = APIHelper.RFC3339DateTime.from_value(dictionary.get("notBefore")).datetime if dictionary.get("notBefore") else None
        not_after = APIHelper.RFC3339DateTime.from_value(dictionary.get("notAfter")).datetime if dictionary.get("notAfter") else None

        # Return an object of this model
        return cls(not_before,
                   not_after)
