# coding: utf-8

"""
    Camunda Platform REST API

    OpenApi Spec for Camunda Platform REST API.  # noqa: E501

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


import pprint
import re  # noqa: F401

import six

from generic_camunda_client.configuration import Configuration


class ExternalTaskFailureDto(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 = {
        'error_message': 'str',
        'error_details': 'str',
        'retries': 'int',
        'retry_timeout': 'int',
        'variables': 'dict(str, VariableValueDto)',
        'local_variables': 'dict(str, VariableValueDto)',
        'worker_id': 'str'
    }

    attribute_map = {
        'error_message': 'errorMessage',
        'error_details': 'errorDetails',
        'retries': 'retries',
        'retry_timeout': 'retryTimeout',
        'variables': 'variables',
        'local_variables': 'localVariables',
        'worker_id': 'workerId'
    }

    def __init__(self, error_message=None, error_details=None, retries=None, retry_timeout=None, variables=None, local_variables=None, worker_id=None, local_vars_configuration=None):  # noqa: E501
        """ExternalTaskFailureDto - 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._error_message = None
        self._error_details = None
        self._retries = None
        self._retry_timeout = None
        self._variables = None
        self._local_variables = None
        self._worker_id = None
        self.discriminator = None

        self.error_message = error_message
        self.error_details = error_details
        self.retries = retries
        self.retry_timeout = retry_timeout
        self.variables = variables
        self.local_variables = local_variables
        if worker_id is not None:
            self.worker_id = worker_id

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

        An message indicating the reason of the failure.  # noqa: E501

        :return: The error_message of this ExternalTaskFailureDto.  # noqa: E501
        :rtype: str
        """
        return self._error_message

    @error_message.setter
    def error_message(self, error_message):
        """Sets the error_message of this ExternalTaskFailureDto.

        An message indicating the reason of the failure.  # noqa: E501

        :param error_message: The error_message of this ExternalTaskFailureDto.  # noqa: E501
        :type: str
        """

        self._error_message = error_message

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

        A detailed error description.  # noqa: E501

        :return: The error_details of this ExternalTaskFailureDto.  # noqa: E501
        :rtype: str
        """
        return self._error_details

    @error_details.setter
    def error_details(self, error_details):
        """Sets the error_details of this ExternalTaskFailureDto.

        A detailed error description.  # noqa: E501

        :param error_details: The error_details of this ExternalTaskFailureDto.  # noqa: E501
        :type: str
        """

        self._error_details = error_details

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

        A number of how often the task should be retried. Must be >= 0. If this is 0, an incident is created and the task cannot be fetched anymore unless the retries are increased again. The incident's message is set to the `errorMessage` parameter.  # noqa: E501

        :return: The retries of this ExternalTaskFailureDto.  # noqa: E501
        :rtype: int
        """
        return self._retries

    @retries.setter
    def retries(self, retries):
        """Sets the retries of this ExternalTaskFailureDto.

        A number of how often the task should be retried. Must be >= 0. If this is 0, an incident is created and the task cannot be fetched anymore unless the retries are increased again. The incident's message is set to the `errorMessage` parameter.  # noqa: E501

        :param retries: The retries of this ExternalTaskFailureDto.  # noqa: E501
        :type: int
        """

        self._retries = retries

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

        A timeout in milliseconds before the external task becomes available again for fetching. Must be >= 0.  # noqa: E501

        :return: The retry_timeout of this ExternalTaskFailureDto.  # noqa: E501
        :rtype: int
        """
        return self._retry_timeout

    @retry_timeout.setter
    def retry_timeout(self, retry_timeout):
        """Sets the retry_timeout of this ExternalTaskFailureDto.

        A timeout in milliseconds before the external task becomes available again for fetching. Must be >= 0.  # noqa: E501

        :param retry_timeout: The retry_timeout of this ExternalTaskFailureDto.  # noqa: E501
        :type: int
        """

        self._retry_timeout = retry_timeout

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

        A JSON object containing variable key-value pairs. Each key is a variable name and each value a JSON variable value object with the following properties:  # noqa: E501

        :return: The variables of this ExternalTaskFailureDto.  # noqa: E501
        :rtype: dict(str, VariableValueDto)
        """
        return self._variables

    @variables.setter
    def variables(self, variables):
        """Sets the variables of this ExternalTaskFailureDto.

        A JSON object containing variable key-value pairs. Each key is a variable name and each value a JSON variable value object with the following properties:  # noqa: E501

        :param variables: The variables of this ExternalTaskFailureDto.  # noqa: E501
        :type: dict(str, VariableValueDto)
        """

        self._variables = variables

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

        A JSON object containing local variable key-value pairs. Local variables are set only in the scope of external task. Each key is a variable name and each value a JSON variable value object with the following properties:  # noqa: E501

        :return: The local_variables of this ExternalTaskFailureDto.  # noqa: E501
        :rtype: dict(str, VariableValueDto)
        """
        return self._local_variables

    @local_variables.setter
    def local_variables(self, local_variables):
        """Sets the local_variables of this ExternalTaskFailureDto.

        A JSON object containing local variable key-value pairs. Local variables are set only in the scope of external task. Each key is a variable name and each value a JSON variable value object with the following properties:  # noqa: E501

        :param local_variables: The local_variables of this ExternalTaskFailureDto.  # noqa: E501
        :type: dict(str, VariableValueDto)
        """

        self._local_variables = local_variables

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

        **Mandatory.** The ID of the worker who is performing the operation on the external task. If the task is already locked, must match the id of the worker who has most recently locked the task.  # noqa: E501

        :return: The worker_id of this ExternalTaskFailureDto.  # noqa: E501
        :rtype: str
        """
        return self._worker_id

    @worker_id.setter
    def worker_id(self, worker_id):
        """Sets the worker_id of this ExternalTaskFailureDto.

        **Mandatory.** The ID of the worker who is performing the operation on the external task. If the task is already locked, must match the id of the worker who has most recently locked the task.  # noqa: E501

        :param worker_id: The worker_id of this ExternalTaskFailureDto.  # noqa: E501
        :type: str
        """

        self._worker_id = worker_id

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

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