scala.googleapis.bigquery.ScriptOptionsKeyResultStatement.scala Maven / Gradle / Ivy
package googleapis.bigquery
import io.circe._
sealed abstract class ScriptOptionsKeyResultStatement(val value: String)
extends Product
with Serializable
object ScriptOptionsKeyResultStatement {
/** Default value.
*/
case object KEY_RESULT_STATEMENT_KIND_UNSPECIFIED
extends ScriptOptionsKeyResultStatement("KEY_RESULT_STATEMENT_KIND_UNSPECIFIED")
/** The last result determines the key result.
*/
case object LAST extends ScriptOptionsKeyResultStatement("LAST")
/** The first SELECT statement determines the key result.
*/
case object FIRST_SELECT extends ScriptOptionsKeyResultStatement("FIRST_SELECT")
val values = List(KEY_RESULT_STATEMENT_KIND_UNSPECIFIED, LAST, FIRST_SELECT)
def fromString(input: String): Either[String, ScriptOptionsKeyResultStatement] = values
.find(_.value == input)
.toRight(s"'$input' was not a valid value for ScriptOptionsKeyResultStatement")
implicit val decoder: Decoder[ScriptOptionsKeyResultStatement] =
Decoder[String].emap(s => fromString(s))
implicit val encoder: Encoder[ScriptOptionsKeyResultStatement] =
Encoder[String].contramap(_.value)
}