# coding: utf-8

"""
    Sparks OpenAPI

    Generated documentation for the Logicdrop Sparks API and OpenAPI clients.  Logicdrop Sparks lets users build rules, analyze data, and automate documents.  Use it to make decisions faster, generate documents better, and learn from your data.  ### Documentation - [User Documentation](https://docs.logicdrop.com)  ### Modules - [Sparks Compute](https://docs.logicdrop.com/rules/introduction) - [Sparks Decision Tables](https://docs.logicdrop.com/rules/authoring-decision-tables) - [Sparks Documents](https://docs.logicdrop.com/documents/introduction)  ### Clients - [OpenAPI Clients](https://docs.logicdrop.com/development/sample-clients)  ### Security - [Authorizing API Requests](https://docs.logicdrop.com/development/authorization)   # noqa: E501

    The version of the OpenAPI document: v_VERSION_._BUILD_
    Contact: support@logicdrop.com
    Generated by: https://openapi-generator.tech
"""


import pprint
import re  # noqa: F401

import six

from logicdrop.sparks.openapi.configuration import Configuration


class Field(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 = {
        'name': 'str',
        'display': 'str',
        'description': 'str',
        'default_value': 'object',
        'format': 'str',
        'type': 'str',
        'mode': 'str',
        'mapping': 'str',
        'order': 'int',
        'key': 'bool',
        'index': 'bool',
        'enabled': 'bool',
        'visible': 'bool',
        'required': 'bool',
        'min': 'int',
        'max': 'int',
        'properties': 'dict(str, object)',
        'children': 'list[Field]'
    }

    attribute_map = {
        'name': 'name',
        'display': 'display',
        'description': 'description',
        'default_value': 'defaultValue',
        'format': 'format',
        'type': 'type',
        'mode': 'mode',
        'mapping': 'mapping',
        'order': 'order',
        'key': 'key',
        'index': 'index',
        'enabled': 'enabled',
        'visible': 'visible',
        'required': 'required',
        'min': 'min',
        'max': 'max',
        'properties': 'properties',
        'children': 'children'
    }

    def __init__(self, name=None, display=None, description=None, default_value=None, format=None, type=None, mode=None, mapping=None, order=None, key=None, index=None, enabled=None, visible=None, required=None, min=None, max=None, properties=None, children=None, local_vars_configuration=None):  # noqa: E501
        """Field - 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._name = None
        self._display = None
        self._description = None
        self._default_value = None
        self._format = None
        self._type = None
        self._mode = None
        self._mapping = None
        self._order = None
        self._key = None
        self._index = None
        self._enabled = None
        self._visible = None
        self._required = None
        self._min = None
        self._max = None
        self._properties = None
        self._children = None
        self.discriminator = None

        if name is not None:
            self.name = name
        if display is not None:
            self.display = display
        if description is not None:
            self.description = description
        if default_value is not None:
            self.default_value = default_value
        if format is not None:
            self.format = format
        if type is not None:
            self.type = type
        if mode is not None:
            self.mode = mode
        if mapping is not None:
            self.mapping = mapping
        if order is not None:
            self.order = order
        if key is not None:
            self.key = key
        if index is not None:
            self.index = index
        if enabled is not None:
            self.enabled = enabled
        if visible is not None:
            self.visible = visible
        if required is not None:
            self.required = required
        if min is not None:
            self.min = min
        if max is not None:
            self.max = max
        if properties is not None:
            self.properties = properties
        if children is not None:
            self.children = children

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


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

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


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

        self._name = name

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


        :return: The display of this Field.  # noqa: E501
        :rtype: str
        """
        return self._display

    @display.setter
    def display(self, display):
        """Sets the display of this Field.


        :param display: The display of this Field.  # noqa: E501
        :type: str
        """

        self._display = display

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


        :return: The description of this Field.  # noqa: E501
        :rtype: str
        """
        return self._description

    @description.setter
    def description(self, description):
        """Sets the description of this Field.


        :param description: The description of this Field.  # noqa: E501
        :type: str
        """

        self._description = description

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


        :return: The default_value of this Field.  # noqa: E501
        :rtype: object
        """
        return self._default_value

    @default_value.setter
    def default_value(self, default_value):
        """Sets the default_value of this Field.


        :param default_value: The default_value of this Field.  # noqa: E501
        :type: object
        """

        self._default_value = default_value

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


        :return: The format of this Field.  # noqa: E501
        :rtype: str
        """
        return self._format

    @format.setter
    def format(self, format):
        """Sets the format of this Field.


        :param format: The format of this Field.  # noqa: E501
        :type: str
        """

        self._format = format

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


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

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


        :param type: The type of this Field.  # noqa: E501
        :type: str
        """
        allowed_values = ["STRING", "INTEGER", "DOUBLE", "DECIMAL", "BOOLEAN", "OBJECT", "DATE", "DATE_TIME", "TIME", "LIST", "SET", "MAP"]  # noqa: E501
        if self.local_vars_configuration.client_side_validation and type not in allowed_values:  # noqa: E501
            raise ValueError(
                "Invalid value for `type` ({0}), must be one of {1}"  # noqa: E501
                .format(type, allowed_values)
            )

        self._type = type

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


        :return: The mode of this Field.  # noqa: E501
        :rtype: str
        """
        return self._mode

    @mode.setter
    def mode(self, mode):
        """Sets the mode of this Field.


        :param mode: The mode of this Field.  # noqa: E501
        :type: str
        """
        allowed_values = ["READ_ONLY", "READ_WRITE", "WRITE_ONLY"]  # noqa: E501
        if self.local_vars_configuration.client_side_validation and mode not in allowed_values:  # noqa: E501
            raise ValueError(
                "Invalid value for `mode` ({0}), must be one of {1}"  # noqa: E501
                .format(mode, allowed_values)
            )

        self._mode = mode

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


        :return: The mapping of this Field.  # noqa: E501
        :rtype: str
        """
        return self._mapping

    @mapping.setter
    def mapping(self, mapping):
        """Sets the mapping of this Field.


        :param mapping: The mapping of this Field.  # noqa: E501
        :type: str
        """

        self._mapping = mapping

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


        :return: The order of this Field.  # noqa: E501
        :rtype: int
        """
        return self._order

    @order.setter
    def order(self, order):
        """Sets the order of this Field.


        :param order: The order of this Field.  # noqa: E501
        :type: int
        """

        self._order = order

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


        :return: The key of this Field.  # noqa: E501
        :rtype: bool
        """
        return self._key

    @key.setter
    def key(self, key):
        """Sets the key of this Field.


        :param key: The key of this Field.  # noqa: E501
        :type: bool
        """

        self._key = key

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


        :return: The index of this Field.  # noqa: E501
        :rtype: bool
        """
        return self._index

    @index.setter
    def index(self, index):
        """Sets the index of this Field.


        :param index: The index of this Field.  # noqa: E501
        :type: bool
        """

        self._index = index

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


        :return: The enabled of this Field.  # noqa: E501
        :rtype: bool
        """
        return self._enabled

    @enabled.setter
    def enabled(self, enabled):
        """Sets the enabled of this Field.


        :param enabled: The enabled of this Field.  # noqa: E501
        :type: bool
        """

        self._enabled = enabled

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


        :return: The visible of this Field.  # noqa: E501
        :rtype: bool
        """
        return self._visible

    @visible.setter
    def visible(self, visible):
        """Sets the visible of this Field.


        :param visible: The visible of this Field.  # noqa: E501
        :type: bool
        """

        self._visible = visible

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


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

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


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

        self._required = required

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


        :return: The min of this Field.  # noqa: E501
        :rtype: int
        """
        return self._min

    @min.setter
    def min(self, min):
        """Sets the min of this Field.


        :param min: The min of this Field.  # noqa: E501
        :type: int
        """

        self._min = min

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


        :return: The max of this Field.  # noqa: E501
        :rtype: int
        """
        return self._max

    @max.setter
    def max(self, max):
        """Sets the max of this Field.


        :param max: The max of this Field.  # noqa: E501
        :type: int
        """

        self._max = max

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


        :return: The properties of this Field.  # noqa: E501
        :rtype: dict(str, object)
        """
        return self._properties

    @properties.setter
    def properties(self, properties):
        """Sets the properties of this Field.


        :param properties: The properties of this Field.  # noqa: E501
        :type: dict(str, object)
        """

        self._properties = properties

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


        :return: The children of this Field.  # noqa: E501
        :rtype: list[Field]
        """
        return self._children

    @children.setter
    def children(self, children):
        """Sets the children of this Field.


        :param children: The children of this Field.  # noqa: E501
        :type: list[Field]
        """

        self._children = children

    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, Field):
            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, Field):
            return True

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