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

"""
instagramapi

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


class MetaData(object):

    """Implementation of the 'MetaData' model.

    Attributes:
        code (int): HTTP result code

    """

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

    _optionals = [
        'code',
    ]

    def __init__(self,
                 code=APIHelper.SKIP):
        """Constructor for the MetaData class"""

        # Initialize members of the class
        if code is not APIHelper.SKIP:
            self.code = code 

    @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 not isinstance(dictionary, dict) or dictionary is None:
            return None

        # Extract variables from the dictionary
        code = dictionary.get("code") if dictionary.get("code") else APIHelper.SKIP
        # Return an object of this model
        return cls(code)

    def __repr__(self):
        return (f'{self.__class__.__name__}('
                f'code={(self.code if hasattr(self, "code") else None)!r})')

    def __str__(self):
        return (f'{self.__class__.__name__}('
                f'code={(self.code if hasattr(self, "code") else None)!s})')
