/**
 * 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 JobScheduleState.
 */
public enum JobScheduleState {
    /** The Job Schedule is active and will create Jobs as per its schedule. */
    ACTIVE("active"),

    /** The Job Schedule has terminated, either by reaching its end time or by the user terminating it explicitly. */
    COMPLETED("completed"),

    /** The user has disabled the Job Schedule. The scheduler will not initiate any new Jobs will on this schedule, but any existing active Job will continue to run. */
    DISABLED("disabled"),

    /** The Job Schedule has no more work to do, or has been explicitly terminated by the user, but the termination operation is still in progress. The scheduler will not initiate any new Jobs for this Job Schedule, nor is any existing Job active. */
    TERMINATING("terminating"),

    /** The user has requested that the Job Schedule be deleted, but the delete operation is still in progress. The scheduler will not initiate any new Jobs for this Job Schedule, and will delete any existing Jobs and Tasks under the Job Schedule, including any active Job. The Job Schedule will be deleted when all Jobs and Tasks under the Job Schedule have been deleted. */
    DELETING("deleting");

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

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

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

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