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

"""
spotifywebapiwithfixesandimprovementsfromsonallux

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


class CopyrightObject(object):

    """Implementation of the 'CopyrightObject' model.

    Attributes:
        text (str): The copyright text for this content.
        mtype (str): The type of copyright: `C` = the copyright, `P` = the
            sound recording (performance) copyright.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "text": 'text',
        "mtype": 'type'
    }

    _optionals = [
        'text',
        'mtype',
    ]

    def __init__(self,
                 text=APIHelper.SKIP,
                 mtype=APIHelper.SKIP):
        """Constructor for the CopyrightObject class"""

        # Initialize members of the class
        if text is not APIHelper.SKIP:
            self.text = text 
        if mtype is not APIHelper.SKIP:
            self.mtype = mtype 

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

    @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'text={(self.text if hasattr(self, "text") else None)!r}, '
                f'mtype={(self.mtype if hasattr(self, "mtype") else None)!r})')

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