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

"""
ctddocumentation

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


class RiskVector(object):

    """Implementation of the 'RiskVector' model.

    TODO: type model description here.

    Attributes:
        details (list of Detail): TODO: type description here.
        name (string): TODO: type description here.
        scale (float): TODO: type description here.
        score (float): TODO: type description here.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "details": 'details',
        "name": 'name',
        "scale": 'scale',
        "score": 'score'
    }

    _optionals = [
        'details',
        'name',
        'scale',
        'score',
    ]

    def __init__(self,
                 details=APIHelper.SKIP,
                 name=APIHelper.SKIP,
                 scale=APIHelper.SKIP,
                 score=APIHelper.SKIP):
        """Constructor for the RiskVector class"""

        # Initialize members of the class
        if details is not APIHelper.SKIP:
            self.details = details 
        if name is not APIHelper.SKIP:
            self.name = name 
        if scale is not APIHelper.SKIP:
            self.scale = scale 
        if score is not APIHelper.SKIP:
            self.score = score 

    @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

        details = None
        if dictionary.get('details') is not None:
            details = [Detail.from_dictionary(x) for x in dictionary.get('details')]
        else:
            details = APIHelper.SKIP
        name = dictionary.get("name") if dictionary.get("name") else APIHelper.SKIP
        scale = dictionary.get("scale") if dictionary.get("scale") else APIHelper.SKIP
        score = dictionary.get("score") if dictionary.get("score") else APIHelper.SKIP
        # Return an object of this model
        return cls(details,
                   name,
                   scale,
                   score)
