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

"""
   wegene.Models.AncestryBlock

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


class AncestryBlock(object):

    """Implementation of the 'ancestry block' model.

    User ancestry composition blocks information

    Attributes:
        african (string): composition component
        middle_eastern (string): composition component
        ne_asian (string): composition component
        se_asian (string): composition component
        chinese_nation (string): composition component
        central_asian (string): composition component
        european (string): composition component
        american (string): composition component
        south_asian (string): composition component
        oceanian (string): composition component

    """

    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::

                    african -- string -- composition component
                    middle_eastern -- string -- composition component
                    ne_asian -- string -- composition component
                    se_asian -- string -- composition component
                    chinese_nation -- string -- composition component
                    central_asian -- string -- composition component
                    european -- string -- composition component
                    american -- string -- composition component
                    south_asian -- string -- composition component
                    oceanian -- string -- composition component

        """
        # Set all of the parameters to their default values
        self.african = None
        self.middle_eastern = None
        self.ne_asian = None
        self.se_asian = None
        self.chinese_nation = None
        self.central_asian = None
        self.european = None
        self.american = None
        self.south_asian = None
        self.oceanian = None

        # Create a mapping from API property names to Model property names
        replace_names = {
            "african": "african",
            "middle_eastern": "middle_eastern",
            "ne_asian": "ne_asian",
            "se_asian": "se_asian",
            "chinese_nation": "chinese_nation",
            "central_asian": "central_asian",
            "european": "european",
            "american": "american",
            "south_asian": "south_asian",
            "oceanian": "oceanian",
        }

        # 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 = {
            "african": "african",
            "middle_eastern": "middle_eastern",
            "ne_asian": "ne_asian",
            "se_asian": "se_asian",
            "chinese_nation": "chinese_nation",
            "central_asian": "central_asian",
            "european": "european",
            "american": "american",
            "south_asian": "south_asian",
            "oceanian": "oceanian",
        }

        retval = dict()

        return APIHelper.resolve_names(self, replace_names, retval)
