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

package com.azure.resourcemanager.managementgroups.models;

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

/** The users specific permissions to this item. */
public enum Permissions {
    /** Enum value noaccess. */
    NOACCESS("noaccess"),

    /** Enum value view. */
    VIEW("view"),

    /** Enum value edit. */
    EDIT("edit"),

    /** Enum value delete. */
    DELETE("delete");

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

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

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

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