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

commonMain.tools.ozone.moderation.Token.kt Maven / Gradle / Ivy

The newest version!
package tools.ozone.moderation

import kotlin.String
import kotlinx.serialization.KSerializer
import kotlinx.serialization.Serializable
import sh.christian.ozone.api.model.AtpEnum
import sh.christian.ozone.api.runtime.stringEnumSerializer

public class TokenSerializer : KSerializer by  stringEnumSerializer(Token::safeValueOf)

@Serializable(with = TokenSerializer::class)
public sealed class Token(
  override val `value`: String,
) : AtpEnum() {
  public data object ReviewOpen : Token("tools.ozone.moderation.defs#reviewOpen")

  public data object ReviewEscalated : Token("tools.ozone.moderation.defs#reviewEscalated")

  public data object ReviewClosed : Token("tools.ozone.moderation.defs#reviewClosed")

  public data object ReviewNone : Token("tools.ozone.moderation.defs#reviewNone")

  public data class Unknown(
    public val rawValue: String,
  ) : Token(rawValue)

  public companion object {
    public fun safeValueOf(`value`: String): Token = when (value) {
      "tools.ozone.moderation.defs#reviewOpen" -> ReviewOpen
      "tools.ozone.moderation.defs#reviewEscalated" -> ReviewEscalated
      "tools.ozone.moderation.defs#reviewClosed" -> ReviewClosed
      "tools.ozone.moderation.defs#reviewNone" -> ReviewNone
      else -> Unknown(value)
    }
  }
}

public class StatusSerializer : KSerializer by  stringEnumSerializer(Status::safeValueOf)

@Serializable(with = StatusSerializer::class)
public sealed class Status(
  override val `value`: String,
) : AtpEnum() {
  public data object Unknown : Status("unknown")

  public data object Deactivated : Status("deactivated")

  public data object Deleted : Status("deleted")

  public data object Takendown : Status("takendown")

  public data object Suspended : Status("suspended")

  public data object Tombstoned : Status("tombstoned")

  public data class _Unknown(
    public val rawValue: String,
  ) : Status(rawValue)

  public companion object {
    public fun safeValueOf(`value`: String): Status = when (value) {
      "unknown" -> Unknown
      "deactivated" -> Deactivated
      "deleted" -> Deleted
      "takendown" -> Takendown
      "suspended" -> Suspended
      "tombstoned" -> Tombstoned
      else -> _Unknown(value)
    }
  }
}

public class OpSerializer : KSerializer by  stringEnumSerializer(Op::safeValueOf)

@Serializable(with = OpSerializer::class)
public sealed class Op(
  override val `value`: String,
) : AtpEnum() {
  public data object Create : Op("create")

  public data object Update : Op("update")

  public data object Delete : Op("delete")

  public data class Unknown(
    public val rawValue: String,
  ) : Op(rawValue)

  public companion object {
    public fun safeValueOf(`value`: String): Op = when (value) {
      "create" -> Create
      "update" -> Update
      "delete" -> Delete
      else -> Unknown(value)
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy