# coding: utf-8

"""
    Ibutsu API

    A system to store and query test results  # noqa: E501

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


import pprint
import re  # noqa: F401

import six

from ibutsu_client.configuration import Configuration


class Result(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',
        'test_id': 'str',
        'start_time': 'str',
        'duration': 'float',
        'result': 'str',
        'metadata': 'object',
        'params': 'object',
        'source': 'str'
    }

    attribute_map = {
        'id': 'id',
        'test_id': 'test_id',
        'start_time': 'start_time',
        'duration': 'duration',
        'result': 'result',
        'metadata': 'metadata',
        'params': 'params',
        'source': 'source'
    }

    def __init__(self, id=None, test_id=None, start_time=None, duration=None, result=None, metadata=None, params=None, source=None, local_vars_configuration=None):  # noqa: E501
        """Result - 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._test_id = None
        self._start_time = None
        self._duration = None
        self._result = None
        self._metadata = None
        self._params = None
        self._source = None
        self.discriminator = None

        if id is not None:
            self.id = id
        if test_id is not None:
            self.test_id = test_id
        if start_time is not None:
            self.start_time = start_time
        if duration is not None:
            self.duration = duration
        if result is not None:
            self.result = result
        if metadata is not None:
            self.metadata = metadata
        if params is not None:
            self.params = params
        if source is not None:
            self.source = source

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

        Unique ID of the test result  # noqa: E501

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

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

        Unique ID of the test result  # noqa: E501

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

        self._id = id

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

        Unique id  # noqa: E501

        :return: The test_id of this Result.  # noqa: E501
        :rtype: str
        """
        return self._test_id

    @test_id.setter
    def test_id(self, test_id):
        """Sets the test_id of this Result.

        Unique id  # noqa: E501

        :param test_id: The test_id of this Result.  # noqa: E501
        :type: str
        """

        self._test_id = test_id

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

        Timestamp of starttime.  # noqa: E501

        :return: The start_time of this Result.  # noqa: E501
        :rtype: str
        """
        return self._start_time

    @start_time.setter
    def start_time(self, start_time):
        """Sets the start_time of this Result.

        Timestamp of starttime.  # noqa: E501

        :param start_time: The start_time of this Result.  # noqa: E501
        :type: str
        """

        self._start_time = start_time

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

        Duration of test in seconds.  # noqa: E501

        :return: The duration of this Result.  # noqa: E501
        :rtype: float
        """
        return self._duration

    @duration.setter
    def duration(self, duration):
        """Sets the duration of this Result.

        Duration of test in seconds.  # noqa: E501

        :param duration: The duration of this Result.  # noqa: E501
        :type: float
        """

        self._duration = duration

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

        Status of result.  # noqa: E501

        :return: The result of this Result.  # noqa: E501
        :rtype: str
        """
        return self._result

    @result.setter
    def result(self, result):
        """Sets the result of this Result.

        Status of result.  # noqa: E501

        :param result: The result of this Result.  # noqa: E501
        :type: str
        """
        allowed_values = ["passed", "failed", "error", "skipped"]  # noqa: E501
        if self.local_vars_configuration.client_side_validation and result not in allowed_values:  # noqa: E501
            raise ValueError(
                "Invalid value for `result` ({0}), must be one of {1}"  # noqa: E501
                .format(result, allowed_values)
            )

        self._result = result

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


        :return: The metadata of this Result.  # noqa: E501
        :rtype: object
        """
        return self._metadata

    @metadata.setter
    def metadata(self, metadata):
        """Sets the metadata of this Result.


        :param metadata: The metadata of this Result.  # noqa: E501
        :type: object
        """

        self._metadata = metadata

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


        :return: The params of this Result.  # noqa: E501
        :rtype: object
        """
        return self._params

    @params.setter
    def params(self, params):
        """Sets the params of this Result.


        :param params: The params of this Result.  # noqa: E501
        :type: object
        """

        self._params = params

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

        Where the data came from (useful for filtering)  # noqa: E501

        :return: The source of this Result.  # noqa: E501
        :rtype: str
        """
        return self._source

    @source.setter
    def source(self, source):
        """Sets the source of this Result.

        Where the data came from (useful for filtering)  # noqa: E501

        :param source: The source of this Result.  # noqa: E501
        :type: str
        """

        self._source = source

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

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