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

"""
spotifywebapiwithfixesandimprovementsfromsonallux

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


class MePlayerRequest(object):

    """Implementation of the 'Me Player Request' model.

    Attributes:
        device_ids (List[str]): A JSON array containing the ID of the device
            on which playback should be started/transferred.<br/>For
            example:`{device_ids:["74ASZWbe4lXaubB36ztrGX"]}`<br/>_**Note**:
            Although an array is accepted, only a single device_id is
            currently supported. Supplying more than one will return `400 Bad
            Request`_
        play (bool): **true**: ensure playback happens on new
            device.<br/>**false** or not provided: keep the current playback
            state.

    """

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

    _optionals = [
        'play',
    ]

    def __init__(self,
                 device_ids=None,
                 play=APIHelper.SKIP):
        """Constructor for the MePlayerRequest class"""

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

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

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

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