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

"""
cookiesapi

This file was automatically generated by APIMATIC v3.0 (
 https://www.apimatic.io ).
"""
from cookiesapi.models.brand_spec import BrandSpec
from cookiesapi.models.breeder import Breeder
from cookiesapi.models.material_info import MaterialInfo
from cookiesapi.models.name import Name
from cookiesapi.models.strain_media import StrainMedia
from cookiesapi.models.strain_social import StrainSocial
from cookiesapi.models.theme import Theme


class Strain(object):

    """Implementation of the 'Strain' model.

    Describes a Cookies strain.

    Attributes:
        id (string): Unique ID assigned to this strain.
        slug (string): Unique URL slug assigned to this strain.
        name (Name): Name of the strain.
        brand (BrandSpec): Brand info for the strain.
        species (SpeciesEnum): Species for the strain.
        media (StrainMedia): Media assigned to a strain.
        material (MaterialInfo): Material info for a strain.
        breeder (list of Breeder): Breeder info for a strain.
        visible (bool): Whether a strain is visible.
        social (StrainSocial): Social information for a strain.
        featured (bool): Whether a strain is featured.
        exclusive (bool): Whether a strain is exclusive to Cookies.
        theme (Theme): Theme information for a strain.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "id": 'id',
        "slug": 'slug',
        "name": 'name',
        "brand": 'brand',
        "species": 'species',
        "media": 'media',
        "material": 'material',
        "breeder": 'breeder',
        "visible": 'visible',
        "social": 'social',
        "featured": 'featured',
        "exclusive": 'exclusive',
        "theme": 'theme'
    }

    def __init__(self,
                 id=None,
                 slug=None,
                 name=None,
                 brand=None,
                 species=None,
                 media=None,
                 material=None,
                 breeder=None,
                 visible=None,
                 social=None,
                 featured=None,
                 exclusive=None,
                 theme=None):
        """Constructor for the Strain class"""

        # Initialize members of the class
        self.id = id
        self.slug = slug
        self.name = name
        self.brand = brand
        self.species = species
        self.media = media
        self.material = material
        self.breeder = breeder
        self.visible = visible
        self.social = social
        self.featured = featured
        self.exclusive = exclusive
        self.theme = theme

    @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
        id = dictionary.get('id')
        slug = dictionary.get('slug')
        name = Name.from_dictionary(dictionary.get('name')) if dictionary.get('name') else None
        brand = BrandSpec.from_dictionary(dictionary.get('brand')) if dictionary.get('brand') else None
        species = dictionary.get('species')
        media = StrainMedia.from_dictionary(dictionary.get('media')) if dictionary.get('media') else None
        material = MaterialInfo.from_dictionary(dictionary.get('material')) if dictionary.get('material') else None
        breeder = None
        if dictionary.get('breeder') is not None:
            breeder = [Breeder.from_dictionary(x) for x in dictionary.get('breeder')]
        visible = dictionary.get('visible')
        social = StrainSocial.from_dictionary(dictionary.get('social')) if dictionary.get('social') else None
        featured = dictionary.get('featured')
        exclusive = dictionary.get('exclusive')
        theme = Theme.from_dictionary(dictionary.get('theme')) if dictionary.get('theme') else None

        # Return an object of this model
        return cls(id,
                   slug,
                   name,
                   brand,
                   species,
                   media,
                   material,
                   breeder,
                   visible,
                   social,
                   featured,
                   exclusive,
                   theme)
