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

"""
pqapiv2

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


class CreatedOn(object):

    """Implementation of the '_createdOn' model.

    Time at which the object was created.

    Attributes:
        created_on (datetime): Time at which the object was created.

    """

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

    def __init__(self,
                 created_on=None):
        """Constructor for the CreatedOn class"""

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

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