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

"""
cookiesapi

This file was automatically generated by APIMATIC v3.0 (
 https://www.apimatic.io ).
"""
from cookiesapi.models.color import Color


class Theme(object):

    """Implementation of the 'Theme' model.

    OpenCannabis record which describes theming information for a given
    record.

    Attributes:
        primary (Color): Primary color.
        secondary (Color): Secondary color.
        alert (Color): Alert color.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "primary": 'primary',
        "secondary": 'secondary',
        "alert": 'alert'
    }

    def __init__(self,
                 primary=None,
                 secondary=None,
                 alert=None):
        """Constructor for the Theme class"""

        # Initialize members of the class
        self.primary = primary
        self.secondary = secondary
        self.alert = alert

    @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 dictionary is None:
            return None

        # Extract variables from the dictionary
        primary = Color.from_dictionary(dictionary.get('primary')) if dictionary.get('primary') else None
        secondary = Color.from_dictionary(dictionary.get('secondary')) if dictionary.get('secondary') else None
        alert = Color.from_dictionary(dictionary.get('alert')) if dictionary.get('alert') else None

        # Return an object of this model
        return cls(primary,
                   secondary,
                   alert)
