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

"""
instagramapi

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


class ImageInfo(object):

    """Implementation of the 'ImageInfo' model.

    Attributes:
        height (int): Image/video height in pixels
        url (str): URL of the image/video resource
        width (int): Image/video width in pixels

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "height": 'height',
        "url": 'url',
        "width": 'width'
    }

    _optionals = [
        'height',
        'url',
        'width',
    ]

    def __init__(self,
                 height=APIHelper.SKIP,
                 url=APIHelper.SKIP,
                 width=APIHelper.SKIP):
        """Constructor for the ImageInfo class"""

        # Initialize members of the class
        if height is not APIHelper.SKIP:
            self.height = height 
        if url is not APIHelper.SKIP:
            self.url = url 
        if width is not APIHelper.SKIP:
            self.width = width 

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

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

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