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

"""
spotifywebapiwithfixesandimprovementsfromsonallux

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


class PlaylistTracksRefObject(object):

    """Implementation of the 'PlaylistTracksRefObject' model.

    Attributes:
        href (str): A link to the Web API endpoint where full details of the
            playlist's tracks can be retrieved.
        total (int): Number of tracks in the playlist.

    """

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

    _optionals = [
        'href',
        'total',
    ]

    def __init__(self,
                 href=APIHelper.SKIP,
                 total=APIHelper.SKIP):
        """Constructor for the PlaylistTracksRefObject class"""

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

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

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

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