# -*- 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.cursor_pagination_info import CursorPaginationInfo
from instagramapi.models.meta_data import MetaData
from instagramapi.models.user_short_info import UserShortInfo


class UsersPagingResponse(object):

    """Implementation of the 'UsersPagingResponse' model.

    Attributes:
        data (List[UserShortInfo]): List of user short information entries
        meta (MetaData): The model property of type MetaData.
        pagination (CursorPaginationInfo): The model property of type
            CursorPaginationInfo.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "data": 'data',
        "meta": 'meta',
        "pagination": 'pagination'
    }

    _optionals = [
        'data',
        'meta',
        'pagination',
    ]

    def __init__(self,
                 data=APIHelper.SKIP,
                 meta=APIHelper.SKIP,
                 pagination=APIHelper.SKIP):
        """Constructor for the UsersPagingResponse class"""

        # Initialize members of the class
        if data is not APIHelper.SKIP:
            self.data = data 
        if meta is not APIHelper.SKIP:
            self.meta = meta 
        if pagination is not APIHelper.SKIP:
            self.pagination = pagination 

    @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
        data = None
        if dictionary.get('data') is not None:
            data = [UserShortInfo.from_dictionary(x) for x in dictionary.get('data')]
        else:
            data = APIHelper.SKIP
        meta = MetaData.from_dictionary(dictionary.get('meta')) if 'meta' in dictionary.keys() else APIHelper.SKIP
        pagination = CursorPaginationInfo.from_dictionary(dictionary.get('pagination')) if 'pagination' in dictionary.keys() else APIHelper.SKIP
        # Return an object of this model
        return cls(data,
                   meta,
                   pagination)

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

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