# -*- 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.followers_object import FollowersObject


class PlaylistOwnerObject(object):

    """Implementation of the 'PlaylistOwnerObject' model.

    Attributes:
        external_urls (ExternalUrlObject): Known public external URLs for this
            user.
        followers (FollowersObject): Information about the followers of this
            user.
        href (str): A link to the Web API endpoint for this user.
        id (str): The [Spotify user
            ID](/documentation/web-api/concepts/spotify-uris-ids) for this
            user.
        mtype (Type3Enum): The object type.
        uri (str): The [Spotify
            URI](/documentation/web-api/concepts/spotify-uris-ids) for this
            user.
        display_name (str): The name displayed on the user's profile. `null`
            if not available.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "external_urls": 'external_urls',
        "followers": 'followers',
        "href": 'href',
        "id": 'id',
        "mtype": 'type',
        "uri": 'uri',
        "display_name": 'display_name'
    }

    _optionals = [
        'external_urls',
        'followers',
        'href',
        'id',
        'mtype',
        'uri',
        'display_name',
    ]

    _nullables = [
        'display_name',
    ]

    def __init__(self,
                 external_urls=APIHelper.SKIP,
                 followers=APIHelper.SKIP,
                 href=APIHelper.SKIP,
                 id=APIHelper.SKIP,
                 mtype=APIHelper.SKIP,
                 uri=APIHelper.SKIP,
                 display_name=APIHelper.SKIP):
        """Constructor for the PlaylistOwnerObject class"""

        # Initialize members of the class
        if external_urls is not APIHelper.SKIP:
            self.external_urls = external_urls 
        if followers is not APIHelper.SKIP:
            self.followers = followers 
        if href is not APIHelper.SKIP:
            self.href = href 
        if id is not APIHelper.SKIP:
            self.id = id 
        if mtype is not APIHelper.SKIP:
            self.mtype = mtype 
        if uri is not APIHelper.SKIP:
            self.uri = uri 
        if display_name is not APIHelper.SKIP:
            self.display_name = display_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
        external_urls = ExternalUrlObject.from_dictionary(dictionary.get('external_urls')) if 'external_urls' in dictionary.keys() else APIHelper.SKIP
        followers = FollowersObject.from_dictionary(dictionary.get('followers')) if 'followers' 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
        mtype = dictionary.get("type") if dictionary.get("type") else APIHelper.SKIP
        uri = dictionary.get("uri") if dictionary.get("uri") else APIHelper.SKIP
        display_name = dictionary.get("display_name") if "display_name" in dictionary.keys() else APIHelper.SKIP
        # Return an object of this model
        return cls(external_urls,
                   followers,
                   href,
                   id,
                   mtype,
                   uri,
                   display_name)

    def __repr__(self):
        return (f'{self.__class__.__name__}('
                f'external_urls={(self.external_urls if hasattr(self, "external_urls") else None)!r}, '
                f'followers={(self.followers if hasattr(self, "followers") 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'mtype={(self.mtype if hasattr(self, "mtype") else None)!r}, '
                f'uri={(self.uri if hasattr(self, "uri") else None)!r}, '
                f'display_name={(self.display_name if hasattr(self, "display_name") else None)!r})')

    def __str__(self):
        return (f'{self.__class__.__name__}('
                f'external_urls={(self.external_urls if hasattr(self, "external_urls") else None)!s}, '
                f'followers={(self.followers if hasattr(self, "followers") 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'mtype={(self.mtype if hasattr(self, "mtype") else None)!s}, '
                f'uri={(self.uri if hasattr(self, "uri") else None)!s}, '
                f'display_name={(self.display_name if hasattr(self, "display_name") else None)!s})')
