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

"""
spotifywebapiwithfixesandimprovementsfromsonallux

This file was automatically generated by APIMATIC v3.0 (
 https://www.apimatic.io ).
"""
from spotifywebapiwithfixesandimprovementsfromsonallux.models.recommendation_seed_object import RecommendationSeedObject
from spotifywebapiwithfixesandimprovementsfromsonallux.models.track_object import TrackObject


class RecommendationsObject(object):

    """Implementation of the 'RecommendationsObject' model.

    Attributes:
        seeds (List[RecommendationSeedObject]): An array of recommendation
            seed objects.
        tracks (List[TrackObject]): An array of track objects ordered
            according to the parameters supplied.

    """

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

    def __init__(self,
                 seeds=None,
                 tracks=None):
        """Constructor for the RecommendationsObject class"""

        # Initialize members of the class
        self.seeds = seeds 
        self.tracks = tracks 

    @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
        seeds = None
        if dictionary.get('seeds') is not None:
            seeds = [RecommendationSeedObject.from_dictionary(x) for x in dictionary.get('seeds')]
        tracks = None
        if dictionary.get('tracks') is not None:
            tracks = [TrackObject.from_dictionary(x) for x in dictionary.get('tracks')]
        # Return an object of this model
        return cls(seeds,
                   tracks)

    def __repr__(self):
        return (f'{self.__class__.__name__}('
                f'seeds={self.seeds!r}, '
                f'tracks={self.tracks!r})')

    def __str__(self):
        return (f'{self.__class__.__name__}('
                f'seeds={self.seeds!s}, '
                f'tracks={self.tracks!s})')
