/**
 *
 * Please note:
 * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * Do not edit this file manually.
 *
 */

@file:Suppress(
    "ArrayInDataClass",
    "EnumEntryName",
    "RemoveRedundantQualifierName",
    "UnusedImport"
)

package org.openapitools.client.models


import com.fasterxml.jackson.annotation.JsonProperty

/**
 * 
 *
 * Values: success,failure,unclassified,unknown_default_open_api
 */

enum class StringEnumRef(val value: kotlin.String) {

    @JsonProperty(value = "success")
    success("success"),

    @JsonProperty(value = "failure")
    failure("failure"),

    @JsonProperty(value = "unclassified")
    unclassified("unclassified"),

    @JsonProperty(value = "unknown_default_open_api")
    unknown_default_open_api("unknown_default_open_api");

    /**
     * Override [toString()] to avoid using the enum variable name as the value, and instead use
     * the actual value defined in the API spec file.
     *
     * This solves a problem when the variable name and its value are different, and ensures that
     * the client sends the correct enum values to the server always.
     */
    override fun toString(): kotlin.String = value

    companion object {
        /**
         * Converts the provided [data] to a [String] on success, null otherwise.
         */
        fun encode(data: kotlin.Any?): kotlin.String? = if (data is StringEnumRef) "$data" else null

        /**
         * Returns a valid [StringEnumRef] for [data], null otherwise.
         */
        fun decode(data: kotlin.Any?): StringEnumRef? = data?.let {
          val normalizedData = "$it".lowercase()
          values().firstOrNull { value ->
            it == value || normalizedData == "$value".lowercase()
          }
        }
    }
}

