# 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 TrainRun(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',
        'job_id': 'str',
        'controller_actor_id': 'str',
        'status': 'RunStatus',
        'status_detail': 'str',
        'start_time_ms': 'int',
        'end_time_ms': 'int',
        'attempts': 'list[TrainRunAttempt]',
        'total_attempts': 'int',
        'job_details': 'JobDetails',
        'session_name': 'str',
        'controller_log_id': 'str',
        'train_run_panels': 'list[DashboardPanel]',
        'train_worker_panels': 'list[DashboardPanel]'
    }

    attribute_map = {
        'id': 'id',
        'name': 'name',
        'job_id': 'job_id',
        'controller_actor_id': 'controller_actor_id',
        'status': 'status',
        'status_detail': 'status_detail',
        'start_time_ms': 'start_time_ms',
        'end_time_ms': 'end_time_ms',
        'attempts': 'attempts',
        'total_attempts': 'total_attempts',
        'job_details': 'job_details',
        'session_name': 'session_name',
        'controller_log_id': 'controller_log_id',
        'train_run_panels': 'train_run_panels',
        'train_worker_panels': 'train_worker_panels'
    }

    def __init__(self, id=None, name=None, job_id=None, controller_actor_id=None, status=None, status_detail=None, start_time_ms=None, end_time_ms=None, attempts=None, total_attempts=None, job_details=None, session_name=None, controller_log_id=None, train_run_panels=None, train_worker_panels=None, local_vars_configuration=None):  # noqa: E501
        """TrainRun - 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._job_id = None
        self._controller_actor_id = None
        self._status = None
        self._status_detail = None
        self._start_time_ms = None
        self._end_time_ms = None
        self._attempts = None
        self._total_attempts = None
        self._job_details = None
        self._session_name = None
        self._controller_log_id = None
        self._train_run_panels = None
        self._train_worker_panels = None
        self.discriminator = None

        self.id = id
        self.name = name
        self.job_id = job_id
        if controller_actor_id is not None:
            self.controller_actor_id = controller_actor_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.attempts = attempts
        self.total_attempts = total_attempts
        self.job_details = job_details
        if session_name is not None:
            self.session_name = session_name
        if controller_log_id is not None:
            self.controller_log_id = controller_log_id
        if train_run_panels is not None:
            self.train_run_panels = train_run_panels
        if train_worker_panels is not None:
            self.train_worker_panels = train_worker_panels

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


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

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


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

        self._id = id

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


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

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


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

        self._name = name

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


        :return: The job_id of this TrainRun.  # noqa: E501
        :rtype: str
        """
        return self._job_id

    @job_id.setter
    def job_id(self, job_id):
        """Sets the job_id of this TrainRun.


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

        self._job_id = job_id

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


        :return: The controller_actor_id of this TrainRun.  # noqa: E501
        :rtype: str
        """
        return self._controller_actor_id

    @controller_actor_id.setter
    def controller_actor_id(self, controller_actor_id):
        """Sets the controller_actor_id of this TrainRun.


        :param controller_actor_id: The controller_actor_id of this TrainRun.  # noqa: E501
        :type: str
        """

        self._controller_actor_id = controller_actor_id

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


        :return: The status of this TrainRun.  # noqa: E501
        :rtype: RunStatus
        """
        return self._status

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


        :param status: The status of this TrainRun.  # noqa: E501
        :type: RunStatus
        """
        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 TrainRun.  # noqa: E501


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

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


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

        self._status_detail = status_detail

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


        :return: The start_time_ms of this TrainRun.  # 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 TrainRun.


        :param start_time_ms: The start_time_ms of this TrainRun.  # 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 TrainRun.  # noqa: E501


        :return: The end_time_ms of this TrainRun.  # 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 TrainRun.


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

        self._end_time_ms = end_time_ms

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


        :return: The attempts of this TrainRun.  # noqa: E501
        :rtype: list[TrainRunAttempt]
        """
        return self._attempts

    @attempts.setter
    def attempts(self, attempts):
        """Sets the attempts of this TrainRun.


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

        self._attempts = attempts

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


        :return: The total_attempts of this TrainRun.  # noqa: E501
        :rtype: int
        """
        return self._total_attempts

    @total_attempts.setter
    def total_attempts(self, total_attempts):
        """Sets the total_attempts of this TrainRun.


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

        self._total_attempts = total_attempts

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


        :return: The job_details of this TrainRun.  # noqa: E501
        :rtype: JobDetails
        """
        return self._job_details

    @job_details.setter
    def job_details(self, job_details):
        """Sets the job_details of this TrainRun.


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

        self._job_details = job_details

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


        :return: The session_name of this TrainRun.  # noqa: E501
        :rtype: str
        """
        return self._session_name

    @session_name.setter
    def session_name(self, session_name):
        """Sets the session_name of this TrainRun.


        :param session_name: The session_name of this TrainRun.  # noqa: E501
        :type: str
        """

        self._session_name = session_name

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


        :return: The controller_log_id of this TrainRun.  # noqa: E501
        :rtype: str
        """
        return self._controller_log_id

    @controller_log_id.setter
    def controller_log_id(self, controller_log_id):
        """Sets the controller_log_id of this TrainRun.


        :param controller_log_id: The controller_log_id of this TrainRun.  # noqa: E501
        :type: str
        """

        self._controller_log_id = controller_log_id

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


        :return: The train_run_panels of this TrainRun.  # noqa: E501
        :rtype: list[DashboardPanel]
        """
        return self._train_run_panels

    @train_run_panels.setter
    def train_run_panels(self, train_run_panels):
        """Sets the train_run_panels of this TrainRun.


        :param train_run_panels: The train_run_panels of this TrainRun.  # noqa: E501
        :type: list[DashboardPanel]
        """

        self._train_run_panels = train_run_panels

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


        :return: The train_worker_panels of this TrainRun.  # noqa: E501
        :rtype: list[DashboardPanel]
        """
        return self._train_worker_panels

    @train_worker_panels.setter
    def train_worker_panels(self, train_worker_panels):
        """Sets the train_worker_panels of this TrainRun.


        :param train_worker_panels: The train_worker_panels of this TrainRun.  # noqa: E501
        :type: list[DashboardPanel]
        """

        self._train_worker_panels = train_worker_panels

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

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