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

"""
   wegene.Models.Report

   This file was automatically generated by APIMATIC BETA v2.0 on 02/22/2016
"""
from wegene.APIHelper import APIHelper
from wegene.Models.GenotypesModel import GenotypesModel


class Report(object):

    """Implementation of the 'report' model.

    Report for health risk, drug response or disease carrier information

    Attributes:
        description (string): Description of the item
        mag (string): Research value
        odds (int): Prevelance every 100,000 people
        result (GenotypesModel): Detailed genetic information for the item
        sex (string): Sex the item applied to
        rank (string): Rank of metabolism abilities
        caseid (int): ID of the report item
        score (float): Score of athletigen item
        percent (string): Percentage of health risk in all users
        risk (float): Risk value of health risk items

    """

    def __init__(self,
                 **kwargs):
        """Constructor for the Report class

        Args:
            **kwargs: Keyword Arguments in order to initialise the
                object. Any of the attributes in this object are able to
                be set through the **kwargs of the constructor. The values
                that can be supplied and their types are as follows::

                    description -- string -- Sets the attribute description
                    mag -- string -- Sets the attribute mag
                    odds -- int -- Sets the attribute odds
                    result -- GenotypesModel -- Sets the attribute result
                    sex -- string -- Sets the attribute sex
                    rank -- string -- Rank of metabolism abilities
                    caseid -- int -- ID of the report item
                    score -- float -- Score of athletigen item
                    percent -- string -- Percentage of health risk in all users
                    risk -- float -- Risk value of health risk items

        """
        # Set all of the parameters to their default values
        self.description = None
        self.mag = None
        self.odds = None
        self.result = None
        self.sex = None
        self.rank = None
        self.caseid = None
        self.score = None
        self.percent = None
        self.risk = None

        # Create a mapping from API property names to Model property names
        replace_names = {
            "description": "description",
            "mag": "mag",
            "odds": "odds",
            "result": "result",
            "sex": "sex",
            "rank": "rank",
            "caseid": "caseid",
            "score": "score",
            "percent": "percent",
            "risk": "risk",
        }

        # Parse all of the Key-Value arguments
        if kwargs is not None:
            for key in kwargs:
                # Only add arguments that are actually part of this object
                if key in replace_names:
                    setattr(self, replace_names[key], kwargs[key])

            # Other objects also need to be initialised properly
            if "result" in kwargs:
                self.result = GenotypesModel(**kwargs["result"])

    def resolve_names(self):
        """Creates a dictionary representation of this object.

        This method converts an object to a dictionary that represents the
        format that the model should be in when passed into an API Request.
        Because of this, the generated dictionary may have different
        property names to that of the model itself.

        Returns:
            dict: The dictionary representing the object.

        """
        # Create a mapping from Model property names to API property names
        replace_names = {
            "description": "description",
            "mag": "mag",
            "odds": "odds",
            "result": "result",
            "sex": "sex",
            "rank": "rank",
            "caseid": "caseid",
            "score": "score",
            "percent": "percent",
            "risk": "risk",
        }

        retval = dict()

        return APIHelper.resolve_names(self, replace_names, retval)
