# coding: utf-8

"""
    Managed Ray API

    No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)  # noqa: E501

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


import pprint
import re  # noqa: F401

import six

from openapi_client.configuration import Configuration


class TrainRunAttempt(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 = {
        'run_id': 'str',
        'attempt_id': 'str',
        'status': 'RunAttemptStatus',
        'status_detail': 'str',
        'start_time_ms': 'int',
        'end_time_ms': 'int',
        'resources': 'list[TrainResources]',
        'workers': 'list[TrainWorker]'
    }

    attribute_map = {
        'run_id': 'run_id',
        'attempt_id': 'attempt_id',
        'status': 'status',
        'status_detail': 'status_detail',
        'start_time_ms': 'start_time_ms',
        'end_time_ms': 'end_time_ms',
        'resources': 'resources',
        'workers': 'workers'
    }

    def __init__(self, run_id=None, attempt_id=None, status=None, status_detail=None, start_time_ms=None, end_time_ms=None, resources=None, workers=None, local_vars_configuration=None):  # noqa: E501
        """TrainRunAttempt - 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._run_id = None
        self._attempt_id = None
        self._status = None
        self._status_detail = None
        self._start_time_ms = None
        self._end_time_ms = None
        self._resources = None
        self._workers = None
        self.discriminator = None

        self.run_id = run_id
        self.attempt_id = attempt_id
        self.status = status
        if status_detail is not None:
            self.status_detail = status_detail
        self.start_time_ms = start_time_ms
        if end_time_ms is not None:
            self.end_time_ms = end_time_ms
        self.resources = resources
        self.workers = workers

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


        :return: The run_id of this TrainRunAttempt.  # noqa: E501
        :rtype: str
        """
        return self._run_id

    @run_id.setter
    def run_id(self, run_id):
        """Sets the run_id of this TrainRunAttempt.


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

        self._run_id = run_id

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


        :return: The attempt_id of this TrainRunAttempt.  # noqa: E501
        :rtype: str
        """
        return self._attempt_id

    @attempt_id.setter
    def attempt_id(self, attempt_id):
        """Sets the attempt_id of this TrainRunAttempt.


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

        self._attempt_id = attempt_id

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


        :return: The status of this TrainRunAttempt.  # noqa: E501
        :rtype: RunAttemptStatus
        """
        return self._status

    @status.setter
    def status(self, status):
        """Sets the status of this TrainRunAttempt.


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

        self._status = status

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


        :return: The status_detail of this TrainRunAttempt.  # noqa: E501
        :rtype: str
        """
        return self._status_detail

    @status_detail.setter
    def status_detail(self, status_detail):
        """Sets the status_detail of this TrainRunAttempt.


        :param status_detail: The status_detail of this TrainRunAttempt.  # noqa: E501
        :type: str
        """

        self._status_detail = status_detail

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


        :return: The start_time_ms of this TrainRunAttempt.  # noqa: E501
        :rtype: int
        """
        return self._start_time_ms

    @start_time_ms.setter
    def start_time_ms(self, start_time_ms):
        """Sets the start_time_ms of this TrainRunAttempt.


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

        self._start_time_ms = start_time_ms

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


        :return: The end_time_ms of this TrainRunAttempt.  # noqa: E501
        :rtype: int
        """
        return self._end_time_ms

    @end_time_ms.setter
    def end_time_ms(self, end_time_ms):
        """Sets the end_time_ms of this TrainRunAttempt.


        :param end_time_ms: The end_time_ms of this TrainRunAttempt.  # noqa: E501
        :type: int
        """

        self._end_time_ms = end_time_ms

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


        :return: The resources of this TrainRunAttempt.  # noqa: E501
        :rtype: list[TrainResources]
        """
        return self._resources

    @resources.setter
    def resources(self, resources):
        """Sets the resources of this TrainRunAttempt.


        :param resources: The resources of this TrainRunAttempt.  # noqa: E501
        :type: list[TrainResources]
        """
        if self.local_vars_configuration.client_side_validation and resources is None:  # noqa: E501
            raise ValueError("Invalid value for `resources`, must not be `None`")  # noqa: E501

        self._resources = resources

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


        :return: The workers of this TrainRunAttempt.  # noqa: E501
        :rtype: list[TrainWorker]
        """
        return self._workers

    @workers.setter
    def workers(self, workers):
        """Sets the workers of this TrainRunAttempt.


        :param workers: The workers of this TrainRunAttempt.  # noqa: E501
        :type: list[TrainWorker]
        """
        if self.local_vars_configuration.client_side_validation and workers is None:  # noqa: E501
            raise ValueError("Invalid value for `workers`, must not be `None`")  # noqa: E501

        self._workers = workers

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

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