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

"""
spotifywebapiwithfixesandimprovementsfromsonallux

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


class PlaylistsTracksRequest1(object):

    """Implementation of the 'Playlists Tracks Request1' model.

    Attributes:
        uris (List[str]): The model property of type List[str].
        range_start (int): The position of the first item to be reordered.
        insert_before (int): The position where the items should be
            inserted.<br/>To reorder the items to the end of the playlist,
            simply set _insert_before_ to the position after the last
            item.<br/>Examples:<br/>To reorder the first item to the last
            position in a playlist with 10 items, set _range_start_ to 0, and
            _insert_before_ to 10.<br/>To reorder the last item in a playlist
            with 10 items to the start of the playlist, set _range_start_ to
            9, and _insert_before_ to 0.
        range_length (int): The amount of items to be reordered. Defaults to 1
            if not set.<br/>The range of items to be reordered begins from the
            _range_start_ position, and includes the _range_length_ subsequent
            items.<br/>Example:<br/>To move the items at index 9-10 to the
            start of the playlist, _range_start_ is set to 9, and
            _range_length_ is set to 2.
        snapshot_id (str): The playlist's snapshot ID against which you want
            to make the changes.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "uris": 'uris',
        "range_start": 'range_start',
        "insert_before": 'insert_before',
        "range_length": 'range_length',
        "snapshot_id": 'snapshot_id'
    }

    _optionals = [
        'uris',
        'range_start',
        'insert_before',
        'range_length',
        'snapshot_id',
    ]

    def __init__(self,
                 uris=APIHelper.SKIP,
                 range_start=APIHelper.SKIP,
                 insert_before=APIHelper.SKIP,
                 range_length=APIHelper.SKIP,
                 snapshot_id=APIHelper.SKIP):
        """Constructor for the PlaylistsTracksRequest1 class"""

        # Initialize members of the class
        if uris is not APIHelper.SKIP:
            self.uris = uris 
        if range_start is not APIHelper.SKIP:
            self.range_start = range_start 
        if insert_before is not APIHelper.SKIP:
            self.insert_before = insert_before 
        if range_length is not APIHelper.SKIP:
            self.range_length = range_length 
        if snapshot_id is not APIHelper.SKIP:
            self.snapshot_id = snapshot_id 

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

    def __repr__(self):
        return (f'{self.__class__.__name__}('
                f'uris={(self.uris if hasattr(self, "uris") else None)!r}, '
                f'range_start={(self.range_start if hasattr(self, "range_start") else None)!r}, '
                f'insert_before={(self.insert_before if hasattr(self, "insert_before") else None)!r}, '
                f'range_length={(self.range_length if hasattr(self, "range_length") else None)!r}, '
                f'snapshot_id={(self.snapshot_id if hasattr(self, "snapshot_id") else None)!r})')

    def __str__(self):
        return (f'{self.__class__.__name__}('
                f'uris={(self.uris if hasattr(self, "uris") else None)!s}, '
                f'range_start={(self.range_start if hasattr(self, "range_start") else None)!s}, '
                f'insert_before={(self.insert_before if hasattr(self, "insert_before") else None)!s}, '
                f'range_length={(self.range_length if hasattr(self, "range_length") else None)!s}, '
                f'snapshot_id={(self.snapshot_id if hasattr(self, "snapshot_id") else None)!s})')
