# coding: utf-8

"""
    Allegro REST API

    https://developer.allegro.pl/about  # noqa: E501

    The version of the OpenAPI document: 2020.03.10
    Generated by: https://openapi-generator.tech
"""


import pprint
import re  # noqa: F401

import six

from allegro_api.configuration import Configuration


class CategoryParameter(object):
    """NOTE: This class is auto generated by OpenAPI Generator.
    Ref: https://openapi-generator.tech

    Do not edit the class manually.
    """

    """
    Attributes:
      openapi_types (dict): The key is attribute name
                            and the value is attribute type.
      attribute_map (dict): The key is attribute name
                            and the value is json key in definition.
    """
    openapi_types = {
        'id': 'str',
        'name': 'str',
        'type': 'str',
        'required': 'bool',
        'unit': 'str',
        'options': 'CategoryParameterOptions'
    }

    attribute_map = {
        'id': 'id',
        'name': 'name',
        'type': 'type',
        'required': 'required',
        'unit': 'unit',
        'options': 'options'
    }

    discriminator_value_class_map = {
        'FloatCategoryParameter': 'FloatCategoryParameter',
        'IntegerCategoryParameter': 'IntegerCategoryParameter',
        'DictionaryCategoryParameter': 'DictionaryCategoryParameter',
        'StringCategoryParameter': 'StringCategoryParameter'
    }

    def __init__(self, id=None, name=None, type=None, required=None, unit=None, options=None, local_vars_configuration=None):  # noqa: E501
        """CategoryParameter - a model defined in OpenAPI"""  # noqa: E501
        if local_vars_configuration is None:
            local_vars_configuration = Configuration()
        self.local_vars_configuration = local_vars_configuration

        self._id = None
        self._name = None
        self._type = None
        self._required = None
        self._unit = None
        self._options = None
        self.discriminator = 'type'

        if id is not None:
            self.id = id
        if name is not None:
            self.name = name
        self.type = type
        if required is not None:
            self.required = required
        if unit is not None:
            self.unit = unit
        if options is not None:
            self.options = options

    @property
    def id(self):
        """Gets the id of this CategoryParameter.  # noqa: E501

        The ID of the parameter.  # noqa: E501

        :return: The id of this CategoryParameter.  # noqa: E501
        :rtype: str
        """
        return self._id

    @id.setter
    def id(self, id):
        """Sets the id of this CategoryParameter.

        The ID of the parameter.  # noqa: E501

        :param id: The id of this CategoryParameter.  # noqa: E501
        :type: str
        """

        self._id = id

    @property
    def name(self):
        """Gets the name of this CategoryParameter.  # noqa: E501

        The name of the parameter in Polish.  # noqa: E501

        :return: The name of this CategoryParameter.  # noqa: E501
        :rtype: str
        """
        return self._name

    @name.setter
    def name(self, name):
        """Sets the name of this CategoryParameter.

        The name of the parameter in Polish.  # noqa: E501

        :param name: The name of this CategoryParameter.  # noqa: E501
        :type: str
        """

        self._name = name

    @property
    def type(self):
        """Gets the type of this CategoryParameter.  # noqa: E501

        The type of the parameter. Other fields in this structure may appear based on the type of the parameter.  # noqa: E501

        :return: The type of this CategoryParameter.  # noqa: E501
        :rtype: str
        """
        return self._type

    @type.setter
    def type(self, type):
        """Sets the type of this CategoryParameter.

        The type of the parameter. Other fields in this structure may appear based on the type of the parameter.  # noqa: E501

        :param type: The type of this CategoryParameter.  # noqa: E501
        :type: str
        """
        if self.local_vars_configuration.client_side_validation and type is None:  # noqa: E501
            raise ValueError("Invalid value for `type`, must not be `None`")  # noqa: E501

        self._type = type

    @property
    def required(self):
        """Gets the required of this CategoryParameter.  # noqa: E501

        Indicates whether the value of this parameter must be set in an offer. Offers without required parameters set cannot be published.  # noqa: E501

        :return: The required of this CategoryParameter.  # noqa: E501
        :rtype: bool
        """
        return self._required

    @required.setter
    def required(self, required):
        """Sets the required of this CategoryParameter.

        Indicates whether the value of this parameter must be set in an offer. Offers without required parameters set cannot be published.  # noqa: E501

        :param required: The required of this CategoryParameter.  # noqa: E501
        :type: bool
        """

        self._required = required

    @property
    def unit(self):
        """Gets the unit of this CategoryParameter.  # noqa: E501

        The unit in which values of the parameter are used. May be `null`.  # noqa: E501

        :return: The unit of this CategoryParameter.  # noqa: E501
        :rtype: str
        """
        return self._unit

    @unit.setter
    def unit(self, unit):
        """Sets the unit of this CategoryParameter.

        The unit in which values of the parameter are used. May be `null`.  # noqa: E501

        :param unit: The unit of this CategoryParameter.  # noqa: E501
        :type: str
        """

        self._unit = unit

    @property
    def options(self):
        """Gets the options of this CategoryParameter.  # noqa: E501


        :return: The options of this CategoryParameter.  # noqa: E501
        :rtype: CategoryParameterOptions
        """
        return self._options

    @options.setter
    def options(self, options):
        """Sets the options of this CategoryParameter.


        :param options: The options of this CategoryParameter.  # noqa: E501
        :type: CategoryParameterOptions
        """

        self._options = options

    def get_real_child_model(self, data):
        """Returns the real base class specified by the discriminator"""
        discriminator_key = self.attribute_map[self.discriminator]
        discriminator_value = data[discriminator_key]
        return self.discriminator_value_class_map.get(discriminator_value)

    def to_dict(self):
        """Returns the model properties as a dict"""
        result = {}

        for attr, _ in six.iteritems(self.openapi_types):
            value = getattr(self, attr)
            if isinstance(value, list):
                result[attr] = list(map(
                    lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
                    value
                ))
            elif hasattr(value, "to_dict"):
                result[attr] = value.to_dict()
            elif isinstance(value, dict):
                result[attr] = dict(map(
                    lambda item: (item[0], item[1].to_dict())
                    if hasattr(item[1], "to_dict") else item,
                    value.items()
                ))
            else:
                result[attr] = value

        return result

    def to_str(self):
        """Returns the string representation of the model"""
        return pprint.pformat(self.to_dict())

    def __repr__(self):
        """For `print` and `pprint`"""
        return self.to_str()

    def __eq__(self, other):
        """Returns true if both objects are equal"""
        if not isinstance(other, CategoryParameter):
            return False

        return self.to_dict() == other.to_dict()

    def __ne__(self, other):
        """Returns true if both objects are not equal"""
        if not isinstance(other, CategoryParameter):
            return True

        return self.to_dict() != other.to_dict()
