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

"""
uexcorpapi

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


class Sell(object):

    """Implementation of the 'Sell' model.

    Attributes:
        code (str): The model property of type str.
        colors (str): The model property of type str.
        name (str): The model property of type str.
        name_abbr (str): The model property of type str.
        name_short (str): The model property of type str.
        percentage (str): The model property of type str.
        percentage_end (str): The model property of type str.
        percentage_start (str): The model property of type str.
        additional_properties (Dict[str, Any]): The additional properties for
            the model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "code": 'code',
        "colors": 'colors',
        "name": 'name',
        "name_abbr": 'name_abbr',
        "name_short": 'name_short',
        "percentage": 'percentage',
        "percentage_end": 'percentage_end',
        "percentage_start": 'percentage_start'
    }

    def __init__(self,
                 code=None,
                 colors=None,
                 name=None,
                 name_abbr=None,
                 name_short=None,
                 percentage=None,
                 percentage_end=None,
                 percentage_start=None,
                 additional_properties=None):
        """Constructor for the Sell class"""

        # Initialize members of the class
        self.code = code 
        self.colors = colors 
        self.name = name 
        self.name_abbr = name_abbr 
        self.name_short = name_short 
        self.percentage = percentage 
        self.percentage_end = percentage_end 
        self.percentage_start = percentage_start 

        # Add additional model properties to the instance
        if additional_properties is None:
            additional_properties = {}
        self.additional_properties = additional_properties

    @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 not isinstance(dictionary, dict) or dictionary is None:
            return None

        # Extract variables from the dictionary
        code = dictionary.get("code") if dictionary.get("code") else None
        colors = dictionary.get("colors") if dictionary.get("colors") else None
        name = dictionary.get("name") if dictionary.get("name") else None
        name_abbr = dictionary.get("name_abbr") if dictionary.get("name_abbr") else None
        name_short = dictionary.get("name_short") if dictionary.get("name_short") else None
        percentage = dictionary.get("percentage") if dictionary.get("percentage") else None
        percentage_end = dictionary.get("percentage_end") if dictionary.get("percentage_end") else None
        percentage_start = dictionary.get("percentage_start") if dictionary.get("percentage_start") else None
        additional_properties = APIHelper.get_additional_properties(
            dictionary={k: v for k, v in dictionary.items() if k not in cls._names.values()},
            unboxing_function=lambda value: value)
        # Return an object of this model
        return cls(code,
                   colors,
                   name,
                   name_abbr,
                   name_short,
                   percentage,
                   percentage_end,
                   percentage_start,
                   additional_properties)

    def __repr__(self):
        return (f'{self.__class__.__name__}('
                f'code={self.code!r}, '
                f'colors={self.colors!r}, '
                f'name={self.name!r}, '
                f'name_abbr={self.name_abbr!r}, '
                f'name_short={self.name_short!r}, '
                f'percentage={self.percentage!r}, '
                f'percentage_end={self.percentage_end!r}, '
                f'percentage_start={self.percentage_start!r}, '
                f'additional_properties={self.additional_properties!r})')

    def __str__(self):
        return (f'{self.__class__.__name__}('
                f'code={self.code!s}, '
                f'colors={self.colors!s}, '
                f'name={self.name!s}, '
                f'name_abbr={self.name_abbr!s}, '
                f'name_short={self.name_short!s}, '
                f'percentage={self.percentage!s}, '
                f'percentage_end={self.percentage_end!s}, '
                f'percentage_start={self.percentage_start!s}, '
                f'additional_properties={self.additional_properties!s})')
