All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ru.testit.kotlin.client.models.FailureCategoryModel.kt Maven / Gradle / Ivy

There is a newer version: 0.2.0
Show newest version
/**
 *
 * 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 ru.testit.kotlin.client.models


import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass

/**
 * 
 *
 * Values: InfrastructureDefect,ProductDefect,TestDefect,NoDefect,NoAnalytics
 */

@JsonClass(generateAdapter = false)
enum class FailureCategoryModel(val value: kotlin.String) {

    @Json(name = "InfrastructureDefect")
    InfrastructureDefect("InfrastructureDefect"),

    @Json(name = "ProductDefect")
    ProductDefect("ProductDefect"),

    @Json(name = "TestDefect")
    TestDefect("TestDefect"),

    @Json(name = "NoDefect")
    NoDefect("NoDefect"),

    @Json(name = "NoAnalytics")
    NoAnalytics("NoAnalytics");

    /**
     * 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 FailureCategoryModel) "$data" else null

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





© 2015 - 2024 Weber Informatics LLC | Privacy Policy