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

"""
spotifywebapiwithfixesandimprovementsfromsonallux

This file was automatically generated by APIMATIC v3.0 (
 https://www.apimatic.io ).
"""
from spotifywebapiwithfixesandimprovementsfromsonallux.models.image_object import ImageObject


class CategoryObject(object):

    """Implementation of the 'CategoryObject' model.

    Attributes:
        href (str): A link to the Web API endpoint returning full details of
            the category.
        icons (List[ImageObject]): The category icon, in various sizes.
        id (str): The [Spotify category
            ID](/documentation/web-api/concepts/spotify-uris-ids) of the
            category.
        name (str): The name of the category.

    """

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

    def __init__(self,
                 href=None,
                 icons=None,
                 id=None,
                 name=None):
        """Constructor for the CategoryObject class"""

        # Initialize members of the class
        self.href = href 
        self.icons = icons 
        self.id = id 
        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
        href = dictionary.get("href") if dictionary.get("href") else None
        icons = None
        if dictionary.get('icons') is not None:
            icons = [ImageObject.from_dictionary(x) for x in dictionary.get('icons')]
        id = dictionary.get("id") if dictionary.get("id") else None
        name = dictionary.get("name") if dictionary.get("name") else None
        # Return an object of this model
        return cls(href,
                   icons,
                   id,
                   name)

    def __repr__(self):
        return (f'{self.__class__.__name__}('
                f'href={self.href!r}, '
                f'icons={self.icons!r}, '
                f'id={self.id!r}, '
                f'name={self.name!r})')

    def __str__(self):
        return (f'{self.__class__.__name__}('
                f'href={self.href!s}, '
                f'icons={self.icons!s}, '
                f'id={self.id!s}, '
                f'name={self.name!s})')
