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

"""
   wegene.Models.AncestryComposition

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


class AncestryComposition(object):

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

    Model for user ancestry composition information

    Attributes:
        data_hash (string): WeGene data profile id
        block (AncestryBlock): Ancestry composition by blocks
        area (AncestryArea): Ancestry composition by areas
        update_time (string): Last updated time

    """

    def __init__(self,
                 **kwargs):
        """Constructor for the User 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::

                    data_hash -- string -- WeGene data profile id
                    block -- AncestryBlock) -- Ancestry composition by blocks
                    area -- AncestryArea -- Ancestry composition by areas
                    update_time -- string -- Last updated time


        """
        # Set all of the parameters to their default values
        self.data_hash = None
        self.block = None
        self.area = None
        self.update_time = None

        # Create a mapping from API property names to Model property names
        replace_names = {
            "data_hash": "data_hash",
            "block": "block",
            "area": "area",
            "update_time": "update_time",
        }

        # 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 "block" in kwargs:
                self.block = AncestryBlock(**kwargs["block"])

            if "area" in kwargs:
                self.area = AncestryArea(**kwargs["area"])

    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 = {
            "data_hash": "data_hash",
            "block": "block",
            "area": "area",
            "update_time": "update_time",
        }

        retval = dict()

        return APIHelper.resolve_names(self, replace_names, retval)
