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

"""
instagramapi

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


class UserCounts(object):

    """Implementation of the 'UserCounts' model.

    Attributes:
        followed_by (int): Number of followers of this user
        follows (int): Number of users followed by this user
        media (int): Number of user media

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "followed_by": 'followed_by',
        "follows": 'follows',
        "media": 'media'
    }

    _optionals = [
        'followed_by',
        'follows',
        'media',
    ]

    def __init__(self,
                 followed_by=APIHelper.SKIP,
                 follows=APIHelper.SKIP,
                 media=APIHelper.SKIP):
        """Constructor for the UserCounts class"""

        # Initialize members of the class
        if followed_by is not APIHelper.SKIP:
            self.followed_by = followed_by 
        if follows is not APIHelper.SKIP:
            self.follows = follows 
        if media is not APIHelper.SKIP:
            self.media = media 

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

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

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