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

"""
spotifywebapiwithfixesandimprovementsfromsonallux

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


class CursorObject(object):

    """Implementation of the 'CursorObject' model.

    Attributes:
        after (str): The cursor to use as key to find the next page of items.
        before (str): The cursor to use as key to find the previous page of
            items.

    """

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

    _optionals = [
        'after',
        'before',
    ]

    def __init__(self,
                 after=APIHelper.SKIP,
                 before=APIHelper.SKIP):
        """Constructor for the CursorObject class"""

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

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

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

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