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

"""
spotifywebapiwithfixesandimprovementsfromsonallux

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


class UsersPlaylistsRequest(object):

    """Implementation of the 'Users Playlists Request' model.

    Attributes:
        name (str): The name for the new playlist, for example `"Your Coolest
            Playlist"`. This name does not need to be unique; a user may have
            several playlists with the same name.
        public (bool): Defaults to `true`. If `true` the playlist will be
            public, if `false` it will be private. To be able to create
            private playlists, the user must have granted the
            `playlist-modify-private`
            [scope](/documentation/web-api/concepts/scopes/#list-of-scopes)
        collaborative (bool): Defaults to `false`. If `true` the playlist will
            be collaborative. _**Note**: to create a collaborative playlist
            you must also set `public` to `false`. To create collaborative
            playlists you must have granted `playlist-modify-private` and
            `playlist-modify-public`
            [scopes](/documentation/web-api/concepts/scopes/#list-of-scopes)._
        description (str): value for playlist description as displayed in
            Spotify Clients and in the Web API.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "name": 'name',
        "public": 'public',
        "collaborative": 'collaborative',
        "description": 'description'
    }

    _optionals = [
        'public',
        'collaborative',
        'description',
    ]

    def __init__(self,
                 name=None,
                 public=APIHelper.SKIP,
                 collaborative=APIHelper.SKIP,
                 description=APIHelper.SKIP):
        """Constructor for the UsersPlaylistsRequest class"""

        # Initialize members of the class
        self.name = name 
        if public is not APIHelper.SKIP:
            self.public = public 
        if collaborative is not APIHelper.SKIP:
            self.collaborative = collaborative 
        if description is not APIHelper.SKIP:
            self.description = description 

    @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
        name = dictionary.get("name") if dictionary.get("name") else None
        public = dictionary.get("public") if "public" in dictionary.keys() else APIHelper.SKIP
        collaborative = dictionary.get("collaborative") if "collaborative" in dictionary.keys() else APIHelper.SKIP
        description = dictionary.get("description") if dictionary.get("description") else APIHelper.SKIP
        # Return an object of this model
        return cls(name,
                   public,
                   collaborative,
                   description)

    def __repr__(self):
        return (f'{self.__class__.__name__}('
                f'name={self.name!r}, '
                f'public={(self.public if hasattr(self, "public") else None)!r}, '
                f'collaborative={(self.collaborative if hasattr(self, "collaborative") else None)!r}, '
                f'description={(self.description if hasattr(self, "description") else None)!r})')

    def __str__(self):
        return (f'{self.__class__.__name__}('
                f'name={self.name!s}, '
                f'public={(self.public if hasattr(self, "public") else None)!s}, '
                f'collaborative={(self.collaborative if hasattr(self, "collaborative") else None)!s}, '
                f'description={(self.description if hasattr(self, "description") else None)!s})')
