/**
 * 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 CertificateState.
 */
public enum CertificateState {
    /** The Certificate is available for use in Pools. */
    ACTIVE("active"),

    /** The user has requested that the Certificate be deleted, but the delete operation has not yet completed. You may not reference the Certificate when creating or updating Pools. */
    DELETING("deleting"),

    /** The user requested that the Certificate be deleted, but there are Pools that still have references to the Certificate, or it is still installed on one or more Nodes. (The latter can occur if the Certificate has been removed from the Pool, but the Compute Node has not yet restarted. Compute Nodes refresh their Certificates only when they restart.) You may use the cancel Certificate delete operation to cancel the delete, or the delete Certificate operation to retry the delete. */
    DELETE_FAILED("deletefailed");

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

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

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

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