/**
 * Copyright (c) Microsoft Corporation. All rights reserved.
 * Licensed under the MIT License. See License.txt in the project root for
 * license information.
 *
 * Code generated by Microsoft (R) AutoRest Code Generator.
 */

package com.microsoft.azure.batch.protocol.models;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

/**
 * Defines values for JobReleaseTaskState.
 */
public enum JobReleaseTaskState {
    /** The Task is currently running (including retrying). */
    RUNNING("running"),

    /** The Task has exited with exit code 0, or the Task has exhausted its retry limit, or the Batch service was unable to start the Task due to Task preparation errors (such as resource file download failures). */
    COMPLETED("completed");

    /** The actual serialized value for a JobReleaseTaskState instance. */
    private String value;

    JobReleaseTaskState(String value) {
        this.value = value;
    }

    /**
     * Parses a serialized value to a JobReleaseTaskState instance.
     *
     * @param value the serialized value to parse.
     * @return the parsed JobReleaseTaskState object, or null if unable to parse.
     */
    @JsonCreator
    public static JobReleaseTaskState fromString(String value) {
        JobReleaseTaskState[] items = JobReleaseTaskState.values();
        for (JobReleaseTaskState item : items) {
            if (item.toString().equalsIgnoreCase(value)) {
                return item;
            }
        }
        return null;
    }

    @JsonValue
    @Override
    public String toString() {
        return this.value;
    }
}
