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

package encode.array.models;

/**
 * Defines values for Colors.
 */
public enum Colors {
    /**
     * Enum value blue.
     */
    BLUE("blue"),

    /**
     * Enum value red.
     */
    RED("red"),

    /**
     * Enum value green.
     */
    GREEN("green");

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

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

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

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