# -*- 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.track_1 import Track1


class PlaylistsTracksRequest2(object):

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

    Attributes:
        tracks (List[Track1]): An array of objects containing [Spotify
            URIs](/documentation/web-api/concepts/spotify-uris-ids) of the
            tracks or episodes to remove. For example: `{ "tracks": [{ "uri":
            "spotify:track:4iV5W9uYEdYUVa79Axb7Rh" },{ "uri":
            "spotify:track:1301WleyT98MSxVHPZCA6M" }] }`. A maximum of 100
            objects can be sent at once.
        snapshot_id (str): The playlist's snapshot ID against which you want
            to make the changes. The API will validate that the specified
            items exist and in the specified positions and make the changes,
            even if more recent changes have been made to the playlist.

    """

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

    _optionals = [
        'snapshot_id',
    ]

    def __init__(self,
                 tracks=None,
                 snapshot_id=APIHelper.SKIP):
        """Constructor for the PlaylistsTracksRequest2 class"""

        # Initialize members of the class
        self.tracks = tracks 
        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
        tracks = None
        if dictionary.get('tracks') is not None:
            tracks = [Track1.from_dictionary(x) for x in dictionary.get('tracks')]
        snapshot_id = dictionary.get("snapshot_id") if dictionary.get("snapshot_id") else APIHelper.SKIP
        # Return an object of this model
        return cls(tracks,
                   snapshot_id)

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

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