# coding: utf-8
# Copyright (c) 2016, 2026, Oracle and/or its affiliates.  All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.

# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20251031


from oci.util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel  # noqa: F401
from oci.decorators import init_model_state_from_kwargs


@init_model_state_from_kwargs
class BatchTask(object):
    """
    A batch task contains common properties for all types of job tasks.
    """

    #: A constant which can be used with the type property of a BatchTask.
    #: This constant has a value of "COMPUTE"
    TYPE_COMPUTE = "COMPUTE"

    #: A constant which can be used with the type property of a BatchTask.
    #: This constant has a value of "GROUP"
    TYPE_GROUP = "GROUP"

    #: A constant which can be used with the lifecycle_state property of a BatchTask.
    #: This constant has a value of "ACCEPTED"
    LIFECYCLE_STATE_ACCEPTED = "ACCEPTED"

    #: A constant which can be used with the lifecycle_state property of a BatchTask.
    #: This constant has a value of "WAITING"
    LIFECYCLE_STATE_WAITING = "WAITING"

    #: A constant which can be used with the lifecycle_state property of a BatchTask.
    #: This constant has a value of "IN_PROGRESS"
    LIFECYCLE_STATE_IN_PROGRESS = "IN_PROGRESS"

    #: A constant which can be used with the lifecycle_state property of a BatchTask.
    #: This constant has a value of "SUCCEEDED"
    LIFECYCLE_STATE_SUCCEEDED = "SUCCEEDED"

    #: A constant which can be used with the lifecycle_state property of a BatchTask.
    #: This constant has a value of "FAILED"
    LIFECYCLE_STATE_FAILED = "FAILED"

    #: A constant which can be used with the lifecycle_state property of a BatchTask.
    #: This constant has a value of "CANCELING"
    LIFECYCLE_STATE_CANCELING = "CANCELING"

    #: A constant which can be used with the lifecycle_state property of a BatchTask.
    #: This constant has a value of "CANCELED"
    LIFECYCLE_STATE_CANCELED = "CANCELED"

    def __init__(self, **kwargs):
        """
        Initializes a new BatchTask object with values from keyword arguments. This class has the following subclasses and if you are using this class as input
        to a service operations then you should favor using a subclass over the base class:

        * :class:`~oci.batch.models.ComputeTask`
        * :class:`~oci.batch.models.GroupTask`

        The following keyword arguments are supported (corresponding to the getters/setters of this class):

        :param id:
            The value to assign to the id property of this BatchTask.
        :type id: str

        :param name:
            The value to assign to the name property of this BatchTask.
        :type name: str

        :param hierarchical_name:
            The value to assign to the hierarchical_name property of this BatchTask.
        :type hierarchical_name: str

        :param group_task_name:
            The value to assign to the group_task_name property of this BatchTask.
        :type group_task_name: str

        :param description:
            The value to assign to the description property of this BatchTask.
        :type description: str

        :param type:
            The value to assign to the type property of this BatchTask.
            Allowed values for this property are: "COMPUTE", "GROUP", 'UNKNOWN_ENUM_VALUE'.
            Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.
        :type type: str

        :param lifecycle_state:
            The value to assign to the lifecycle_state property of this BatchTask.
            Allowed values for this property are: "ACCEPTED", "WAITING", "IN_PROGRESS", "SUCCEEDED", "FAILED", "CANCELING", "CANCELED", 'UNKNOWN_ENUM_VALUE'.
            Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.
        :type lifecycle_state: str

        :param lifecycle_details:
            The value to assign to the lifecycle_details property of this BatchTask.
        :type lifecycle_details: str

        :param entitlement_claims:
            The value to assign to the entitlement_claims property of this BatchTask.
        :type entitlement_claims: list[str]

        :param dependencies:
            The value to assign to the dependencies property of this BatchTask.
        :type dependencies: list[str]

        :param environment_variables:
            The value to assign to the environment_variables property of this BatchTask.
        :type environment_variables: list[oci.batch.models.EnvironmentVariable]

        """
        self.swagger_types = {
            'id': 'str',
            'name': 'str',
            'hierarchical_name': 'str',
            'group_task_name': 'str',
            'description': 'str',
            'type': 'str',
            'lifecycle_state': 'str',
            'lifecycle_details': 'str',
            'entitlement_claims': 'list[str]',
            'dependencies': 'list[str]',
            'environment_variables': 'list[EnvironmentVariable]'
        }
        self.attribute_map = {
            'id': 'id',
            'name': 'name',
            'hierarchical_name': 'hierarchicalName',
            'group_task_name': 'groupTaskName',
            'description': 'description',
            'type': 'type',
            'lifecycle_state': 'lifecycleState',
            'lifecycle_details': 'lifecycleDetails',
            'entitlement_claims': 'entitlementClaims',
            'dependencies': 'dependencies',
            'environment_variables': 'environmentVariables'
        }
        self._id = None
        self._name = None
        self._hierarchical_name = None
        self._group_task_name = None
        self._description = None
        self._type = None
        self._lifecycle_state = None
        self._lifecycle_details = None
        self._entitlement_claims = None
        self._dependencies = None
        self._environment_variables = None

    @staticmethod
    def get_subtype(object_dictionary):
        """
        Given the hash representation of a subtype of this class,
        use the info in the hash to return the class of the subtype.
        """
        type = object_dictionary['type']

        if type == 'COMPUTE':
            return 'ComputeTask'

        if type == 'GROUP':
            return 'GroupTask'
        else:
            return 'BatchTask'

    @property
    def id(self):
        """
        **[Required]** Gets the id of this BatchTask.
        The UUID of batch task.


        :return: The id of this BatchTask.
        :rtype: str
        """
        return self._id

    @id.setter
    def id(self, id):
        """
        Sets the id of this BatchTask.
        The UUID of batch task.


        :param id: The id of this BatchTask.
        :type: str
        """
        self._id = id

    @property
    def name(self):
        """
        **[Required]** Gets the name of this BatchTask.
        The name of the batch task. It must be unique within its parent batch job.


        :return: The name of this BatchTask.
        :rtype: str
        """
        return self._name

    @name.setter
    def name(self, name):
        """
        Sets the name of this BatchTask.
        The name of the batch task. It must be unique within its parent batch job.


        :param name: The name of this BatchTask.
        :type: str
        """
        self._name = name

    @property
    def hierarchical_name(self):
        """
        Gets the hierarchical_name of this BatchTask.
        The hierarchical name of the task, which incorporates names of all parent group tasks, separated by \".\" (dot symbol). Maximum nesting depth is 4 levels. Example: groupTaskA.nestedGroupTaskB.thisTaskName


        :return: The hierarchical_name of this BatchTask.
        :rtype: str
        """
        return self._hierarchical_name

    @hierarchical_name.setter
    def hierarchical_name(self, hierarchical_name):
        """
        Sets the hierarchical_name of this BatchTask.
        The hierarchical name of the task, which incorporates names of all parent group tasks, separated by \".\" (dot symbol). Maximum nesting depth is 4 levels. Example: groupTaskA.nestedGroupTaskB.thisTaskName


        :param hierarchical_name: The hierarchical_name of this BatchTask.
        :type: str
        """
        self._hierarchical_name = hierarchical_name

    @property
    def group_task_name(self):
        """
        Gets the group_task_name of this BatchTask.
        The hierarchical name of the group task. Null for top-level tasks.


        :return: The group_task_name of this BatchTask.
        :rtype: str
        """
        return self._group_task_name

    @group_task_name.setter
    def group_task_name(self, group_task_name):
        """
        Sets the group_task_name of this BatchTask.
        The hierarchical name of the group task. Null for top-level tasks.


        :param group_task_name: The group_task_name of this BatchTask.
        :type: str
        """
        self._group_task_name = group_task_name

    @property
    def description(self):
        """
        Gets the description of this BatchTask.
        An optional description that provides additional context next to the displayName.


        :return: The description of this BatchTask.
        :rtype: str
        """
        return self._description

    @description.setter
    def description(self, description):
        """
        Sets the description of this BatchTask.
        An optional description that provides additional context next to the displayName.


        :param description: The description of this BatchTask.
        :type: str
        """
        self._description = description

    @property
    def type(self):
        """
        **[Required]** Gets the type of this BatchTask.
        Type of the batch task. Also serves as a discriminator for sub-entities.

        Allowed values for this property are: "COMPUTE", "GROUP", 'UNKNOWN_ENUM_VALUE'.
        Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.


        :return: The type of this BatchTask.
        :rtype: str
        """
        return self._type

    @type.setter
    def type(self, type):
        """
        Sets the type of this BatchTask.
        Type of the batch task. Also serves as a discriminator for sub-entities.


        :param type: The type of this BatchTask.
        :type: str
        """
        allowed_values = ["COMPUTE", "GROUP"]
        if not value_allowed_none_or_none_sentinel(type, allowed_values):
            type = 'UNKNOWN_ENUM_VALUE'
        self._type = type

    @property
    def lifecycle_state(self):
        """
        Gets the lifecycle_state of this BatchTask.
        The current state of the batch task.

        Allowed values for this property are: "ACCEPTED", "WAITING", "IN_PROGRESS", "SUCCEEDED", "FAILED", "CANCELING", "CANCELED", 'UNKNOWN_ENUM_VALUE'.
        Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.


        :return: The lifecycle_state of this BatchTask.
        :rtype: str
        """
        return self._lifecycle_state

    @lifecycle_state.setter
    def lifecycle_state(self, lifecycle_state):
        """
        Sets the lifecycle_state of this BatchTask.
        The current state of the batch task.


        :param lifecycle_state: The lifecycle_state of this BatchTask.
        :type: str
        """
        allowed_values = ["ACCEPTED", "WAITING", "IN_PROGRESS", "SUCCEEDED", "FAILED", "CANCELING", "CANCELED"]
        if not value_allowed_none_or_none_sentinel(lifecycle_state, allowed_values):
            lifecycle_state = 'UNKNOWN_ENUM_VALUE'
        self._lifecycle_state = lifecycle_state

    @property
    def lifecycle_details(self):
        """
        Gets the lifecycle_details of this BatchTask.
        A message that describes the current state of the batch task in more detail. For example, can be used to provide actionable information for a resource in the Failed state.


        :return: The lifecycle_details of this BatchTask.
        :rtype: str
        """
        return self._lifecycle_details

    @lifecycle_details.setter
    def lifecycle_details(self, lifecycle_details):
        """
        Sets the lifecycle_details of this BatchTask.
        A message that describes the current state of the batch task in more detail. For example, can be used to provide actionable information for a resource in the Failed state.


        :param lifecycle_details: The lifecycle_details of this BatchTask.
        :type: str
        """
        self._lifecycle_details = lifecycle_details

    @property
    def entitlement_claims(self):
        """
        **[Required]** Gets the entitlement_claims of this BatchTask.
        A list of resources (for example licences) this task needs for its execution.


        :return: The entitlement_claims of this BatchTask.
        :rtype: list[str]
        """
        return self._entitlement_claims

    @entitlement_claims.setter
    def entitlement_claims(self, entitlement_claims):
        """
        Sets the entitlement_claims of this BatchTask.
        A list of resources (for example licences) this task needs for its execution.


        :param entitlement_claims: The entitlement_claims of this BatchTask.
        :type: list[str]
        """
        self._entitlement_claims = entitlement_claims

    @property
    def dependencies(self):
        """
        **[Required]** Gets the dependencies of this BatchTask.
        A list of tasks on which this tasks depends, referenced by name. Dependencies must be within the same parent (job or group task). For tasks within a group task, all dependencies must also be within that same group task.


        :return: The dependencies of this BatchTask.
        :rtype: list[str]
        """
        return self._dependencies

    @dependencies.setter
    def dependencies(self, dependencies):
        """
        Sets the dependencies of this BatchTask.
        A list of tasks on which this tasks depends, referenced by name. Dependencies must be within the same parent (job or group task). For tasks within a group task, all dependencies must also be within that same group task.


        :param dependencies: The dependencies of this BatchTask.
        :type: list[str]
        """
        self._dependencies = dependencies

    @property
    def environment_variables(self):
        """
        **[Required]** Gets the environment_variables of this BatchTask.
        Environment variables to use for the task execution.


        :return: The environment_variables of this BatchTask.
        :rtype: list[oci.batch.models.EnvironmentVariable]
        """
        return self._environment_variables

    @environment_variables.setter
    def environment_variables(self, environment_variables):
        """
        Sets the environment_variables of this BatchTask.
        Environment variables to use for the task execution.


        :param environment_variables: The environment_variables of this BatchTask.
        :type: list[oci.batch.models.EnvironmentVariable]
        """
        self._environment_variables = environment_variables

    def __repr__(self):
        return formatted_flat_dict(self)

    def __eq__(self, other):
        if other is None:
            return False

        return self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not self == other
