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

"""
spotifywebapiwithfixesandimprovementsfromsonallux

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


class ExternalIdObject(object):

    """Implementation of the 'ExternalIdObject' model.

    Attributes:
        isrc (str): [International Standard Recording
            Code](http://en.wikipedia.org/wiki/International_Standard_Recording
            _Code)
        ean (str): [International Article
            Number](http://en.wikipedia.org/wiki/International_Article_Number_%
            28EAN%29)
        upc (str): [Universal Product
            Code](http://en.wikipedia.org/wiki/Universal_Product_Code)

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "isrc": 'isrc',
        "ean": 'ean',
        "upc": 'upc'
    }

    _optionals = [
        'isrc',
        'ean',
        'upc',
    ]

    def __init__(self,
                 isrc=APIHelper.SKIP,
                 ean=APIHelper.SKIP,
                 upc=APIHelper.SKIP):
        """Constructor for the ExternalIdObject class"""

        # Initialize members of the class
        if isrc is not APIHelper.SKIP:
            self.isrc = isrc 
        if ean is not APIHelper.SKIP:
            self.ean = ean 
        if upc is not APIHelper.SKIP:
            self.upc = upc 

    @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
        isrc = dictionary.get("isrc") if dictionary.get("isrc") else APIHelper.SKIP
        ean = dictionary.get("ean") if dictionary.get("ean") else APIHelper.SKIP
        upc = dictionary.get("upc") if dictionary.get("upc") else APIHelper.SKIP
        # Return an object of this model
        return cls(isrc,
                   ean,
                   upc)

    @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 True

        if not isinstance(dictionary, dict):
            return False

        return True

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

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