# -*- 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.external_url_object import ExternalUrlObject
from spotifywebapiwithfixesandimprovementsfromsonallux.models.image_object import ImageObject
from spotifywebapiwithfixesandimprovementsfromsonallux.models.playlist_owner_object import PlaylistOwnerObject
from spotifywebapiwithfixesandimprovementsfromsonallux.models.playlist_tracks_ref_object import PlaylistTracksRefObject


class SimplifiedPlaylistObject(object):

    """Implementation of the 'SimplifiedPlaylistObject' model.

    Attributes:
        collaborative (bool): `true` if the owner allows other users to modify
            the playlist.
        description (str): The playlist description. _Only returned for
            modified, verified playlists, otherwise_ `null`.
        external_urls (ExternalUrlObject): Known external URLs for this
            playlist.
        href (str): A link to the Web API endpoint providing full details of
            the playlist.
        id (str): The [Spotify
            ID](/documentation/web-api/concepts/spotify-uris-ids) for the
            playlist.
        images (List[ImageObject]): Images for the playlist. The array may be
            empty or contain up to three images. The images are returned by
            size in descending order. See [Working with
            Playlists](/documentation/web-api/concepts/playlists). _**Note**:
            If returned, the source URL for the image (`url`) is temporary and
            will expire in less than a day._
        name (str): The name of the playlist.
        owner (PlaylistOwnerObject): The user who owns the playlist
        public (bool): The playlist's public/private status: `true` the
            playlist is public, `false` the playlist is private, `null` the
            playlist status is not relevant. For more about public/private
            status, see [Working with
            Playlists](/documentation/web-api/concepts/playlists)
        snapshot_id (str): The version identifier for the current playlist.
            Can be supplied in other requests to target a specific playlist
            version
        tracks (PlaylistTracksRefObject): A collection containing a link (
            `href` ) to the Web API endpoint where full details of the
            playlist's tracks can be retrieved, along with the `total` number
            of tracks in the playlist. Note, a track object may be `null`.
            This can happen if a track is no longer available.
        mtype (str): The object type: "playlist"
        uri (str): The [Spotify
            URI](/documentation/web-api/concepts/spotify-uris-ids) for the
            playlist.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "collaborative": 'collaborative',
        "description": 'description',
        "external_urls": 'external_urls',
        "href": 'href',
        "id": 'id',
        "images": 'images',
        "name": 'name',
        "owner": 'owner',
        "public": 'public',
        "snapshot_id": 'snapshot_id',
        "tracks": 'tracks',
        "mtype": 'type',
        "uri": 'uri'
    }

    _optionals = [
        'collaborative',
        'description',
        'external_urls',
        'href',
        'id',
        'images',
        'name',
        'owner',
        'public',
        'snapshot_id',
        'tracks',
        'mtype',
        'uri',
    ]

    def __init__(self,
                 collaborative=APIHelper.SKIP,
                 description=APIHelper.SKIP,
                 external_urls=APIHelper.SKIP,
                 href=APIHelper.SKIP,
                 id=APIHelper.SKIP,
                 images=APIHelper.SKIP,
                 name=APIHelper.SKIP,
                 owner=APIHelper.SKIP,
                 public=APIHelper.SKIP,
                 snapshot_id=APIHelper.SKIP,
                 tracks=APIHelper.SKIP,
                 mtype=APIHelper.SKIP,
                 uri=APIHelper.SKIP):
        """Constructor for the SimplifiedPlaylistObject class"""

        # Initialize members of the class
        if collaborative is not APIHelper.SKIP:
            self.collaborative = collaborative 
        if description is not APIHelper.SKIP:
            self.description = description 
        if external_urls is not APIHelper.SKIP:
            self.external_urls = external_urls 
        if href is not APIHelper.SKIP:
            self.href = href 
        if id is not APIHelper.SKIP:
            self.id = id 
        if images is not APIHelper.SKIP:
            self.images = images 
        if name is not APIHelper.SKIP:
            self.name = name 
        if owner is not APIHelper.SKIP:
            self.owner = owner 
        if public is not APIHelper.SKIP:
            self.public = public 
        if snapshot_id is not APIHelper.SKIP:
            self.snapshot_id = snapshot_id 
        if tracks is not APIHelper.SKIP:
            self.tracks = tracks 
        if mtype is not APIHelper.SKIP:
            self.mtype = mtype 
        if uri is not APIHelper.SKIP:
            self.uri = uri 

    @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
        collaborative = dictionary.get("collaborative") if "collaborative" in dictionary.keys() else APIHelper.SKIP
        description = dictionary.get("description") if dictionary.get("description") else APIHelper.SKIP
        external_urls = ExternalUrlObject.from_dictionary(dictionary.get('external_urls')) if 'external_urls' in dictionary.keys() else APIHelper.SKIP
        href = dictionary.get("href") if dictionary.get("href") else APIHelper.SKIP
        id = dictionary.get("id") if dictionary.get("id") else APIHelper.SKIP
        images = None
        if dictionary.get('images') is not None:
            images = [ImageObject.from_dictionary(x) for x in dictionary.get('images')]
        else:
            images = APIHelper.SKIP
        name = dictionary.get("name") if dictionary.get("name") else APIHelper.SKIP
        owner = PlaylistOwnerObject.from_dictionary(dictionary.get('owner')) if 'owner' in dictionary.keys() else APIHelper.SKIP
        public = dictionary.get("public") if "public" in dictionary.keys() else APIHelper.SKIP
        snapshot_id = dictionary.get("snapshot_id") if dictionary.get("snapshot_id") else APIHelper.SKIP
        tracks = PlaylistTracksRefObject.from_dictionary(dictionary.get('tracks')) if 'tracks' in dictionary.keys() else APIHelper.SKIP
        mtype = dictionary.get("type") if dictionary.get("type") else APIHelper.SKIP
        uri = dictionary.get("uri") if dictionary.get("uri") else APIHelper.SKIP
        # Return an object of this model
        return cls(collaborative,
                   description,
                   external_urls,
                   href,
                   id,
                   images,
                   name,
                   owner,
                   public,
                   snapshot_id,
                   tracks,
                   mtype,
                   uri)

    def __repr__(self):
        return (f'{self.__class__.__name__}('
                f'collaborative={(self.collaborative if hasattr(self, "collaborative") else None)!r}, '
                f'description={(self.description if hasattr(self, "description") else None)!r}, '
                f'external_urls={(self.external_urls if hasattr(self, "external_urls") else None)!r}, '
                f'href={(self.href if hasattr(self, "href") else None)!r}, '
                f'id={(self.id if hasattr(self, "id") else None)!r}, '
                f'images={(self.images if hasattr(self, "images") else None)!r}, '
                f'name={(self.name if hasattr(self, "name") else None)!r}, '
                f'owner={(self.owner if hasattr(self, "owner") else None)!r}, '
                f'public={(self.public if hasattr(self, "public") else None)!r}, '
                f'snapshot_id={(self.snapshot_id if hasattr(self, "snapshot_id") else None)!r}, '
                f'tracks={(self.tracks if hasattr(self, "tracks") else None)!r}, '
                f'mtype={(self.mtype if hasattr(self, "mtype") else None)!r}, '
                f'uri={(self.uri if hasattr(self, "uri") else None)!r})')

    def __str__(self):
        return (f'{self.__class__.__name__}('
                f'collaborative={(self.collaborative if hasattr(self, "collaborative") else None)!s}, '
                f'description={(self.description if hasattr(self, "description") else None)!s}, '
                f'external_urls={(self.external_urls if hasattr(self, "external_urls") else None)!s}, '
                f'href={(self.href if hasattr(self, "href") else None)!s}, '
                f'id={(self.id if hasattr(self, "id") else None)!s}, '
                f'images={(self.images if hasattr(self, "images") else None)!s}, '
                f'name={(self.name if hasattr(self, "name") else None)!s}, '
                f'owner={(self.owner if hasattr(self, "owner") else None)!s}, '
                f'public={(self.public if hasattr(self, "public") else None)!s}, '
                f'snapshot_id={(self.snapshot_id if hasattr(self, "snapshot_id") else None)!s}, '
                f'tracks={(self.tracks if hasattr(self, "tracks") else None)!s}, '
                f'mtype={(self.mtype if hasattr(self, "mtype") else None)!s}, '
                f'uri={(self.uri if hasattr(self, "uri") else None)!s})')
