# 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 TrainWorker(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 = {
        'actor_id': 'str',
        'world_rank': 'int',
        'local_rank': 'int',
        'node_rank': 'int',
        'node_id': 'str',
        'node_ip': 'str',
        'pid': 'int',
        'gpu_ids': 'list[int]',
        'status': 'ActorStatus',
        'resources': 'TrainResources',
        'log_id': 'str'
    }

    attribute_map = {
        'actor_id': 'actor_id',
        'world_rank': 'world_rank',
        'local_rank': 'local_rank',
        'node_rank': 'node_rank',
        'node_id': 'node_id',
        'node_ip': 'node_ip',
        'pid': 'pid',
        'gpu_ids': 'gpu_ids',
        'status': 'status',
        'resources': 'resources',
        'log_id': 'log_id'
    }

    def __init__(self, actor_id=None, world_rank=None, local_rank=None, node_rank=None, node_id=None, node_ip=None, pid=None, gpu_ids=None, status=None, resources=None, log_id=None, local_vars_configuration=None):  # noqa: E501
        """TrainWorker - 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._actor_id = None
        self._world_rank = None
        self._local_rank = None
        self._node_rank = None
        self._node_id = None
        self._node_ip = None
        self._pid = None
        self._gpu_ids = None
        self._status = None
        self._resources = None
        self._log_id = None
        self.discriminator = None

        self.actor_id = actor_id
        self.world_rank = world_rank
        self.local_rank = local_rank
        self.node_rank = node_rank
        self.node_id = node_id
        self.node_ip = node_ip
        self.pid = pid
        self.gpu_ids = gpu_ids
        self.status = status
        if resources is not None:
            self.resources = resources
        if log_id is not None:
            self.log_id = log_id

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


        :return: The actor_id of this TrainWorker.  # noqa: E501
        :rtype: str
        """
        return self._actor_id

    @actor_id.setter
    def actor_id(self, actor_id):
        """Sets the actor_id of this TrainWorker.


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

        self._actor_id = actor_id

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


        :return: The world_rank of this TrainWorker.  # noqa: E501
        :rtype: int
        """
        return self._world_rank

    @world_rank.setter
    def world_rank(self, world_rank):
        """Sets the world_rank of this TrainWorker.


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

        self._world_rank = world_rank

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


        :return: The local_rank of this TrainWorker.  # noqa: E501
        :rtype: int
        """
        return self._local_rank

    @local_rank.setter
    def local_rank(self, local_rank):
        """Sets the local_rank of this TrainWorker.


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

        self._local_rank = local_rank

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


        :return: The node_rank of this TrainWorker.  # noqa: E501
        :rtype: int
        """
        return self._node_rank

    @node_rank.setter
    def node_rank(self, node_rank):
        """Sets the node_rank of this TrainWorker.


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

        self._node_rank = node_rank

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


        :return: The node_id of this TrainWorker.  # noqa: E501
        :rtype: str
        """
        return self._node_id

    @node_id.setter
    def node_id(self, node_id):
        """Sets the node_id of this TrainWorker.


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

        self._node_id = node_id

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


        :return: The node_ip of this TrainWorker.  # noqa: E501
        :rtype: str
        """
        return self._node_ip

    @node_ip.setter
    def node_ip(self, node_ip):
        """Sets the node_ip of this TrainWorker.


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

        self._node_ip = node_ip

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


        :return: The pid of this TrainWorker.  # noqa: E501
        :rtype: int
        """
        return self._pid

    @pid.setter
    def pid(self, pid):
        """Sets the pid of this TrainWorker.


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

        self._pid = pid

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


        :return: The gpu_ids of this TrainWorker.  # noqa: E501
        :rtype: list[int]
        """
        return self._gpu_ids

    @gpu_ids.setter
    def gpu_ids(self, gpu_ids):
        """Sets the gpu_ids of this TrainWorker.


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

        self._gpu_ids = gpu_ids

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


        :return: The status of this TrainWorker.  # noqa: E501
        :rtype: ActorStatus
        """
        return self._status

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


        :param status: The status of this TrainWorker.  # noqa: E501
        :type: ActorStatus
        """
        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 resources(self):
        """Gets the resources of this TrainWorker.  # noqa: E501


        :return: The resources of this TrainWorker.  # noqa: E501
        :rtype: TrainResources
        """
        return self._resources

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


        :param resources: The resources of this TrainWorker.  # noqa: E501
        :type: TrainResources
        """

        self._resources = resources

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


        :return: The log_id of this TrainWorker.  # noqa: E501
        :rtype: str
        """
        return self._log_id

    @log_id.setter
    def log_id(self, log_id):
        """Sets the log_id of this TrainWorker.


        :param log_id: The log_id of this TrainWorker.  # noqa: E501
        :type: str
        """

        self._log_id = log_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, TrainWorker):
            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, TrainWorker):
            return True

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