// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.labservices.models;

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

/** The state of a virtual machine. */
public enum VirtualMachineState {
    /** Enum value Stopped. */
    STOPPED("Stopped"),

    /** Enum value Starting. */
    STARTING("Starting"),

    /** Enum value Running. */
    RUNNING("Running"),

    /** Enum value Stopping. */
    STOPPING("Stopping"),

    /** Enum value ResettingPassword. */
    RESETTING_PASSWORD("ResettingPassword"),

    /** Enum value Reimaging. */
    REIMAGING("Reimaging"),

    /** Enum value Redeploying. */
    REDEPLOYING("Redeploying");

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

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

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

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