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

"""
spotifywebapiwithfixesandimprovementsfromsonallux

This file was automatically generated by APIMATIC v3.0 (
 https://www.apimatic.io ).
"""
from spotifywebapiwithfixesandimprovementsfromsonallux.api_helper import APIHelper
from spotifywebapiwithfixesandimprovementsfromsonallux.models.paging_artist_object import PagingArtistObject
from spotifywebapiwithfixesandimprovementsfromsonallux.models.paging_playlist_object import PagingPlaylistObject
from spotifywebapiwithfixesandimprovementsfromsonallux.models.paging_simplified_album_object import PagingSimplifiedAlbumObject
from spotifywebapiwithfixesandimprovementsfromsonallux.models.paging_simplified_audiobook_object import PagingSimplifiedAudiobookObject
from spotifywebapiwithfixesandimprovementsfromsonallux.models.paging_simplified_episode_object import PagingSimplifiedEpisodeObject
from spotifywebapiwithfixesandimprovementsfromsonallux.models.paging_simplified_show_object import PagingSimplifiedShowObject
from spotifywebapiwithfixesandimprovementsfromsonallux.models.paging_track_object import PagingTrackObject


class SearchItems(object):

    """Implementation of the 'SearchItems' model.

    Attributes:
        tracks (PagingTrackObject): The model property of type
            PagingTrackObject.
        artists (PagingArtistObject): The model property of type
            PagingArtistObject.
        albums (PagingSimplifiedAlbumObject): The model property of type
            PagingSimplifiedAlbumObject.
        playlists (PagingPlaylistObject): The model property of type
            PagingPlaylistObject.
        shows (PagingSimplifiedShowObject): The model property of type
            PagingSimplifiedShowObject.
        episodes (PagingSimplifiedEpisodeObject): The model property of type
            PagingSimplifiedEpisodeObject.
        audiobooks (PagingSimplifiedAudiobookObject): The model property of
            type PagingSimplifiedAudiobookObject.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "tracks": 'tracks',
        "artists": 'artists',
        "albums": 'albums',
        "playlists": 'playlists',
        "shows": 'shows',
        "episodes": 'episodes',
        "audiobooks": 'audiobooks'
    }

    _optionals = [
        'tracks',
        'artists',
        'albums',
        'playlists',
        'shows',
        'episodes',
        'audiobooks',
    ]

    def __init__(self,
                 tracks=APIHelper.SKIP,
                 artists=APIHelper.SKIP,
                 albums=APIHelper.SKIP,
                 playlists=APIHelper.SKIP,
                 shows=APIHelper.SKIP,
                 episodes=APIHelper.SKIP,
                 audiobooks=APIHelper.SKIP):
        """Constructor for the SearchItems class"""

        # Initialize members of the class
        if tracks is not APIHelper.SKIP:
            self.tracks = tracks 
        if artists is not APIHelper.SKIP:
            self.artists = artists 
        if albums is not APIHelper.SKIP:
            self.albums = albums 
        if playlists is not APIHelper.SKIP:
            self.playlists = playlists 
        if shows is not APIHelper.SKIP:
            self.shows = shows 
        if episodes is not APIHelper.SKIP:
            self.episodes = episodes 
        if audiobooks is not APIHelper.SKIP:
            self.audiobooks = audiobooks 

    @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
        tracks = PagingTrackObject.from_dictionary(dictionary.get('tracks')) if 'tracks' in dictionary.keys() else APIHelper.SKIP
        artists = PagingArtistObject.from_dictionary(dictionary.get('artists')) if 'artists' in dictionary.keys() else APIHelper.SKIP
        albums = PagingSimplifiedAlbumObject.from_dictionary(dictionary.get('albums')) if 'albums' in dictionary.keys() else APIHelper.SKIP
        playlists = PagingPlaylistObject.from_dictionary(dictionary.get('playlists')) if 'playlists' in dictionary.keys() else APIHelper.SKIP
        shows = PagingSimplifiedShowObject.from_dictionary(dictionary.get('shows')) if 'shows' in dictionary.keys() else APIHelper.SKIP
        episodes = PagingSimplifiedEpisodeObject.from_dictionary(dictionary.get('episodes')) if 'episodes' in dictionary.keys() else APIHelper.SKIP
        audiobooks = PagingSimplifiedAudiobookObject.from_dictionary(dictionary.get('audiobooks')) if 'audiobooks' in dictionary.keys() else APIHelper.SKIP
        # Return an object of this model
        return cls(tracks,
                   artists,
                   albums,
                   playlists,
                   shows,
                   episodes,
                   audiobooks)

    def __repr__(self):
        return (f'{self.__class__.__name__}('
                f'tracks={(self.tracks if hasattr(self, "tracks") else None)!r}, '
                f'artists={(self.artists if hasattr(self, "artists") else None)!r}, '
                f'albums={(self.albums if hasattr(self, "albums") else None)!r}, '
                f'playlists={(self.playlists if hasattr(self, "playlists") else None)!r}, '
                f'shows={(self.shows if hasattr(self, "shows") else None)!r}, '
                f'episodes={(self.episodes if hasattr(self, "episodes") else None)!r}, '
                f'audiobooks={(self.audiobooks if hasattr(self, "audiobooks") else None)!r})')

    def __str__(self):
        return (f'{self.__class__.__name__}('
                f'tracks={(self.tracks if hasattr(self, "tracks") else None)!s}, '
                f'artists={(self.artists if hasattr(self, "artists") else None)!s}, '
                f'albums={(self.albums if hasattr(self, "albums") else None)!s}, '
                f'playlists={(self.playlists if hasattr(self, "playlists") else None)!s}, '
                f'shows={(self.shows if hasattr(self, "shows") else None)!s}, '
                f'episodes={(self.episodes if hasattr(self, "episodes") else None)!s}, '
                f'audiobooks={(self.audiobooks if hasattr(self, "audiobooks") else None)!s})')
