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

"""
instagramapi

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


class UserInfo(object):

    """Implementation of the 'UserInfo' model.

    Attributes:
        bio (str): User biography
        counts (UserCounts): The model property of type UserCounts.
        full_name (str): User full name
        id (str): User ID
        profile_picture (str): URL to user profile picture
        username (str): User name, nickname
        website (str): URL to user web-site

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "bio": 'bio',
        "counts": 'counts',
        "full_name": 'full_name',
        "id": 'id',
        "profile_picture": 'profile_picture',
        "username": 'username',
        "website": 'website'
    }

    _optionals = [
        'bio',
        'counts',
        'full_name',
        'id',
        'profile_picture',
        'username',
        'website',
    ]

    def __init__(self,
                 bio=APIHelper.SKIP,
                 counts=APIHelper.SKIP,
                 full_name=APIHelper.SKIP,
                 id=APIHelper.SKIP,
                 profile_picture=APIHelper.SKIP,
                 username=APIHelper.SKIP,
                 website=APIHelper.SKIP):
        """Constructor for the UserInfo class"""

        # Initialize members of the class
        if bio is not APIHelper.SKIP:
            self.bio = bio 
        if counts is not APIHelper.SKIP:
            self.counts = counts 
        if full_name is not APIHelper.SKIP:
            self.full_name = full_name 
        if id is not APIHelper.SKIP:
            self.id = id 
        if profile_picture is not APIHelper.SKIP:
            self.profile_picture = profile_picture 
        if username is not APIHelper.SKIP:
            self.username = username 
        if website is not APIHelper.SKIP:
            self.website = website 

    @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
        bio = dictionary.get("bio") if dictionary.get("bio") else APIHelper.SKIP
        counts = UserCounts.from_dictionary(dictionary.get('counts')) if 'counts' in dictionary.keys() else APIHelper.SKIP
        full_name = dictionary.get("full_name") if dictionary.get("full_name") else APIHelper.SKIP
        id = dictionary.get("id") if dictionary.get("id") else APIHelper.SKIP
        profile_picture = dictionary.get("profile_picture") if dictionary.get("profile_picture") else APIHelper.SKIP
        username = dictionary.get("username") if dictionary.get("username") else APIHelper.SKIP
        website = dictionary.get("website") if dictionary.get("website") else APIHelper.SKIP
        # Return an object of this model
        return cls(bio,
                   counts,
                   full_name,
                   id,
                   profile_picture,
                   username,
                   website)

    def __repr__(self):
        return (f'{self.__class__.__name__}('
                f'bio={(self.bio if hasattr(self, "bio") else None)!r}, '
                f'counts={(self.counts if hasattr(self, "counts") else None)!r}, '
                f'full_name={(self.full_name if hasattr(self, "full_name") else None)!r}, '
                f'id={(self.id if hasattr(self, "id") else None)!r}, '
                f'profile_picture={(self.profile_picture if hasattr(self, "profile_picture") else None)!r}, '
                f'username={(self.username if hasattr(self, "username") else None)!r}, '
                f'website={(self.website if hasattr(self, "website") else None)!r})')

    def __str__(self):
        return (f'{self.__class__.__name__}('
                f'bio={(self.bio if hasattr(self, "bio") else None)!s}, '
                f'counts={(self.counts if hasattr(self, "counts") else None)!s}, '
                f'full_name={(self.full_name if hasattr(self, "full_name") else None)!s}, '
                f'id={(self.id if hasattr(self, "id") else None)!s}, '
                f'profile_picture={(self.profile_picture if hasattr(self, "profile_picture") else None)!s}, '
                f'username={(self.username if hasattr(self, "username") else None)!s}, '
                f'website={(self.website if hasattr(self, "website") else None)!s})')
