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

"""
spotifywebapiwithfixesandimprovementsfromsonallux

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


class ExternalUrlObject(object):

    """Implementation of the 'ExternalUrlObject' model.

    Attributes:
        spotify (str): The [Spotify
            URL](/documentation/web-api/concepts/spotify-uris-ids) for the
            object.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "spotify": 'spotify'
    }

    _optionals = [
        'spotify',
    ]

    def __init__(self,
                 spotify=APIHelper.SKIP):
        """Constructor for the ExternalUrlObject class"""

        # Initialize members of the class
        if spotify is not APIHelper.SKIP:
            self.spotify = spotify 

    @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
        spotify = dictionary.get("spotify") if dictionary.get("spotify") else APIHelper.SKIP
        # Return an object of this model
        return cls(spotify)

    @classmethod
    def validate(cls, dictionary):
        """Validates dictionary against class required properties

        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:
            boolean : if dictionary is valid contains required properties.

        """

        if isinstance(dictionary, cls):
            return True

        if not isinstance(dictionary, dict):
            return False

        return True

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

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