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

"""
instagramapi

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


class TagInfo(object):

    """Implementation of the 'TagInfo' model.

    Attributes:
        media_count (int): Overall number of media entries taged with this name
        name (str): Tag name

    """

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

    _optionals = [
        'media_count',
        'name',
    ]

    def __init__(self,
                 media_count=APIHelper.SKIP,
                 name=APIHelper.SKIP):
        """Constructor for the TagInfo class"""

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

    @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
        media_count = dictionary.get("media_count") if dictionary.get("media_count") else APIHelper.SKIP
        name = dictionary.get("name") if dictionary.get("name") else APIHelper.SKIP
        # Return an object of this model
        return cls(media_count,
                   name)

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

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