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

package com.azure.resourcemanager.customerinsights.models;

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

/** The computation function for the KPI. */
public enum KpiFunctions {
    /** Enum value Sum. */
    SUM("Sum"),

    /** Enum value Avg. */
    AVG("Avg"),

    /** Enum value Min. */
    MIN("Min"),

    /** Enum value Max. */
    MAX("Max"),

    /** Enum value Last. */
    LAST("Last"),

    /** Enum value Count. */
    COUNT("Count"),

    /** Enum value None. */
    NONE("None"),

    /** Enum value CountDistinct. */
    COUNT_DISTINCT("CountDistinct");

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

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

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

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