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

package tsptest.namingjavaparser.models;

/**
 * Defines values for RunObjectLastErrorCode.
 */
public enum RunObjectLastErrorCode {
    /**
     * Enum value server_error.
     */
    SERVER_ERROR("server_error"),

    /**
     * Enum value rate_limit_exceeded.
     */
    RATE_LIMIT_EXCEEDED("rate_limit_exceeded"),

    /**
     * Enum value invalid_prompt.
     */
    INVALID_PROMPT("invalid_prompt");

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

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

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

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