/**
 * 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 DisableComputeNodeSchedulingOption.
 */
public enum DisableComputeNodeSchedulingOption {
    /** Terminate running Task processes and requeue the Tasks. The Tasks may run again on other Compute Nodes, or when Task scheduling is re-enabled on this Compute Node. Enter offline state as soon as Tasks have been terminated. */
    REQUEUE("requeue"),

    /** Terminate running Tasks. The Tasks will be completed with failureInfo indicating that they were terminated, and will not run again. Enter offline state as soon as Tasks have been terminated. */
    TERMINATE("terminate"),

    /** Allow currently running Tasks to complete. Schedule no new Tasks while waiting. Enter offline state when all Tasks have completed. */
    TASK_COMPLETION("taskcompletion");

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

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

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

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