# -*- 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.copyright_object import CopyrightObject
from spotifywebapiwithfixesandimprovementsfromsonallux.models.external_url_object import ExternalUrlObject
from spotifywebapiwithfixesandimprovementsfromsonallux.models.image_object import ImageObject


class ShowBase(object):

    """Implementation of the 'ShowBase' model.

    Attributes:
        available_markets (List[str]): A list of the countries in which the
            show can be played, identified by their [ISO 3166-1
            alpha-2](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) code.
        copyrights (List[CopyrightObject]): The copyright statements of the
            show.
        description (str): A description of the show. HTML tags are stripped
            away from this field, use `html_description` field in case HTML
            tags are needed.
        html_description (str): A description of the show. This field may
            contain HTML tags.
        explicit (bool): Whether or not the show has explicit content (true =
            yes it does; false = no it does not OR unknown).
        external_urls (ExternalUrlObject): External URLs for this show.
        href (str): A link to the Web API endpoint providing full details of
            the show.
        id (str): The [Spotify
            ID](/documentation/web-api/concepts/spotify-uris-ids) for the show.
        images (List[ImageObject]): The cover art for the show in various
            sizes, widest first.
        is_externally_hosted (bool): True if all of the shows episodes are
            hosted outside of Spotify's CDN. This field might be `null` in
            some cases.
        languages (List[str]): A list of the languages used in the show,
            identified by their [ISO
            639](https://en.wikipedia.org/wiki/ISO_639) code.
        media_type (str): The media type of the show.
        name (str): The name of the episode.
        publisher (str): The publisher of the show.
        mtype (str): The object type.
        uri (str): The [Spotify
            URI](/documentation/web-api/concepts/spotify-uris-ids) for the
            show.
        total_episodes (int): The total number of episodes in the show.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "available_markets": 'available_markets',
        "copyrights": 'copyrights',
        "description": 'description',
        "html_description": 'html_description',
        "explicit": 'explicit',
        "external_urls": 'external_urls',
        "href": 'href',
        "id": 'id',
        "images": 'images',
        "is_externally_hosted": 'is_externally_hosted',
        "languages": 'languages',
        "media_type": 'media_type',
        "name": 'name',
        "publisher": 'publisher',
        "mtype": 'type',
        "uri": 'uri',
        "total_episodes": 'total_episodes'
    }

    def __init__(self,
                 available_markets=None,
                 copyrights=None,
                 description=None,
                 html_description=None,
                 explicit=None,
                 external_urls=None,
                 href=None,
                 id=None,
                 images=None,
                 is_externally_hosted=None,
                 languages=None,
                 media_type=None,
                 name=None,
                 publisher=None,
                 uri=None,
                 total_episodes=None):
        """Constructor for the ShowBase class"""

        # Initialize members of the class
        self.available_markets = available_markets 
        self.copyrights = copyrights 
        self.description = description 
        self.html_description = html_description 
        self.explicit = explicit 
        self.external_urls = external_urls 
        self.href = href 
        self.id = id 
        self.images = images 
        self.is_externally_hosted = is_externally_hosted 
        self.languages = languages 
        self.media_type = media_type 
        self.name = name 
        self.publisher = publisher 
        self.mtype = 'show' 
        self.uri = uri 
        self.total_episodes = total_episodes 

    @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
        available_markets = dictionary.get("available_markets") if dictionary.get("available_markets") else None
        copyrights = None
        if dictionary.get('copyrights') is not None:
            copyrights = [CopyrightObject.from_dictionary(x) for x in dictionary.get('copyrights')]
        description = dictionary.get("description") if dictionary.get("description") else None
        html_description = dictionary.get("html_description") if dictionary.get("html_description") else None
        explicit = dictionary.get("explicit") if "explicit" in dictionary.keys() else None
        external_urls = ExternalUrlObject.from_dictionary(dictionary.get('external_urls')) if dictionary.get('external_urls') else None
        href = dictionary.get("href") if dictionary.get("href") else None
        id = dictionary.get("id") if dictionary.get("id") else None
        images = None
        if dictionary.get('images') is not None:
            images = [ImageObject.from_dictionary(x) for x in dictionary.get('images')]
        is_externally_hosted = dictionary.get("is_externally_hosted") if "is_externally_hosted" in dictionary.keys() else None
        languages = dictionary.get("languages") if dictionary.get("languages") else None
        media_type = dictionary.get("media_type") if dictionary.get("media_type") else None
        name = dictionary.get("name") if dictionary.get("name") else None
        publisher = dictionary.get("publisher") if dictionary.get("publisher") else None
        uri = dictionary.get("uri") if dictionary.get("uri") else None
        total_episodes = dictionary.get("total_episodes") if dictionary.get("total_episodes") else None
        # Return an object of this model
        return cls(available_markets,
                   copyrights,
                   description,
                   html_description,
                   explicit,
                   external_urls,
                   href,
                   id,
                   images,
                   is_externally_hosted,
                   languages,
                   media_type,
                   name,
                   publisher,
                   uri,
                   total_episodes)

    @classmethod
    def validate(cls, dictionary):
        """Validates dictionary against class required properties

        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:
            boolean : if dictionary is valid contains required properties.

        """

        if isinstance(dictionary, cls):
            return APIHelper.is_valid_type(value=dictionary.available_markets,
                                           type_callable=lambda value: isinstance(value, str)) \
                and APIHelper.is_valid_type(value=dictionary.copyrights,
                                            type_callable=lambda value: CopyrightObject.validate(value),
                                            is_model_dict=True,
                                            is_inner_model_dict=True) \
                and APIHelper.is_valid_type(value=dictionary.description,
                                            type_callable=lambda value: isinstance(value, str)) \
                and APIHelper.is_valid_type(value=dictionary.html_description,
                                            type_callable=lambda value: isinstance(value, str)) \
                and APIHelper.is_valid_type(value=dictionary.explicit,
                                            type_callable=lambda value: isinstance(value, bool)) \
                and APIHelper.is_valid_type(value=dictionary.external_urls,
                                            type_callable=lambda value: ExternalUrlObject.validate(value),
                                            is_model_dict=True) \
                and APIHelper.is_valid_type(value=dictionary.href,
                                            type_callable=lambda value: isinstance(value, str)) \
                and APIHelper.is_valid_type(value=dictionary.id,
                                            type_callable=lambda value: isinstance(value, str)) \
                and APIHelper.is_valid_type(value=dictionary.images,
                                            type_callable=lambda value: ImageObject.validate(value),
                                            is_model_dict=True,
                                            is_inner_model_dict=True) \
                and APIHelper.is_valid_type(value=dictionary.is_externally_hosted,
                                            type_callable=lambda value: isinstance(value, bool)) \
                and APIHelper.is_valid_type(value=dictionary.languages,
                                            type_callable=lambda value: isinstance(value, str)) \
                and APIHelper.is_valid_type(value=dictionary.media_type,
                                            type_callable=lambda value: isinstance(value, str)) \
                and APIHelper.is_valid_type(value=dictionary.name,
                                            type_callable=lambda value: isinstance(value, str)) \
                and APIHelper.is_valid_type(value=dictionary.publisher,
                                            type_callable=lambda value: isinstance(value, str)) \
                and APIHelper.is_valid_type(value=dictionary.mtype,
                                            type_callable=lambda value: isinstance(value, str)) \
                and APIHelper.is_valid_type(value=dictionary.uri,
                                            type_callable=lambda value: isinstance(value, str)) \
                and APIHelper.is_valid_type(value=dictionary.total_episodes,
                                            type_callable=lambda value: isinstance(value, int))

        if not isinstance(dictionary, dict):
            return False

        return APIHelper.is_valid_type(value=dictionary.get('available_markets'),
                                       type_callable=lambda value: isinstance(value, str)) \
            and APIHelper.is_valid_type(value=dictionary.get('copyrights'),
                                        type_callable=lambda value: CopyrightObject.validate(value),
                                        is_model_dict=True,
                                        is_inner_model_dict=True) \
            and APIHelper.is_valid_type(value=dictionary.get('description'),
                                        type_callable=lambda value: isinstance(value, str)) \
            and APIHelper.is_valid_type(value=dictionary.get('html_description'),
                                        type_callable=lambda value: isinstance(value, str)) \
            and APIHelper.is_valid_type(value=dictionary.get('explicit'),
                                        type_callable=lambda value: isinstance(value, bool)) \
            and APIHelper.is_valid_type(value=dictionary.get('external_urls'),
                                        type_callable=lambda value: ExternalUrlObject.validate(value),
                                        is_model_dict=True) \
            and APIHelper.is_valid_type(value=dictionary.get('href'),
                                        type_callable=lambda value: isinstance(value, str)) \
            and APIHelper.is_valid_type(value=dictionary.get('id'),
                                        type_callable=lambda value: isinstance(value, str)) \
            and APIHelper.is_valid_type(value=dictionary.get('images'),
                                        type_callable=lambda value: ImageObject.validate(value),
                                        is_model_dict=True,
                                        is_inner_model_dict=True) \
            and APIHelper.is_valid_type(value=dictionary.get('is_externally_hosted'),
                                        type_callable=lambda value: isinstance(value, bool)) \
            and APIHelper.is_valid_type(value=dictionary.get('languages'),
                                        type_callable=lambda value: isinstance(value, str)) \
            and APIHelper.is_valid_type(value=dictionary.get('media_type'),
                                        type_callable=lambda value: isinstance(value, str)) \
            and APIHelper.is_valid_type(value=dictionary.get('name'),
                                        type_callable=lambda value: isinstance(value, str)) \
            and APIHelper.is_valid_type(value=dictionary.get('publisher'),
                                        type_callable=lambda value: isinstance(value, str)) \
            and APIHelper.is_valid_type(value=dictionary.get('type'),
                                        type_callable=lambda value: isinstance(value, str)) \
            and APIHelper.is_valid_type(value=dictionary.get('uri'),
                                        type_callable=lambda value: isinstance(value, str)) \
            and APIHelper.is_valid_type(value=dictionary.get('total_episodes'),
                                        type_callable=lambda value: isinstance(value, int))

    def __repr__(self):
        return (f'{self.__class__.__name__}('
                f'available_markets={self.available_markets!r}, '
                f'copyrights={self.copyrights!r}, '
                f'description={self.description!r}, '
                f'html_description={self.html_description!r}, '
                f'explicit={self.explicit!r}, '
                f'external_urls={self.external_urls!r}, '
                f'href={self.href!r}, '
                f'id={self.id!r}, '
                f'images={self.images!r}, '
                f'is_externally_hosted={self.is_externally_hosted!r}, '
                f'languages={self.languages!r}, '
                f'media_type={self.media_type!r}, '
                f'name={self.name!r}, '
                f'publisher={self.publisher!r}, '
                f'mtype={self.mtype!r}, '
                f'uri={self.uri!r}, '
                f'total_episodes={self.total_episodes!r})')

    def __str__(self):
        return (f'{self.__class__.__name__}('
                f'available_markets={self.available_markets!s}, '
                f'copyrights={self.copyrights!s}, '
                f'description={self.description!s}, '
                f'html_description={self.html_description!s}, '
                f'explicit={self.explicit!s}, '
                f'external_urls={self.external_urls!s}, '
                f'href={self.href!s}, '
                f'id={self.id!s}, '
                f'images={self.images!s}, '
                f'is_externally_hosted={self.is_externally_hosted!s}, '
                f'languages={self.languages!s}, '
                f'media_type={self.media_type!s}, '
                f'name={self.name!s}, '
                f'publisher={self.publisher!s}, '
                f'mtype={self.mtype!s}, '
                f'uri={self.uri!s}, '
                f'total_episodes={self.total_episodes!s})')
