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

"""
spotifywebapiwithfixesandimprovementsfromsonallux

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


class ManyAudiobooks(object):

    """Implementation of the 'ManyAudiobooks' model.

    Attributes:
        audiobooks (List[AudiobookObject]): The model property of type
            List[AudiobookObject].

    """

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

    def __init__(self,
                 audiobooks=None):
        """Constructor for the ManyAudiobooks class"""

        # Initialize members of the class
        self.audiobooks = audiobooks 

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

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

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