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

commonMain.com.atproto.label.Token.kt Maven / Gradle / Ivy

The newest version!
package com.atproto.label

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 SeveritySerializer : KSerializer by stringEnumSerializer(Severity::safeValueOf)

/**
 * How should a client visually convey this label? 'inform' means neutral and informational; 'alert'
 * means negative and warning; 'none' means show nothing.
 */
@Serializable(with = SeveritySerializer::class)
public sealed class Severity(
  override val `value`: String,
) : AtpEnum() {
  public data object Inform : Severity("inform")

  public data object Alert : Severity("alert")

  public data object None : Severity("none")

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

  public companion object {
    public fun safeValueOf(`value`: String): Severity = when (value) {
      "inform" -> Inform
      "alert" -> Alert
      "none" -> None
      else -> Unknown(value)
    }
  }
}

public class BlursSerializer : KSerializer by stringEnumSerializer(Blurs::safeValueOf)

/**
 * What should this label hide in the UI, if applied? 'content' hides all of the target; 'media'
 * hides the images/video/audio; 'none' hides nothing.
 */
@Serializable(with = BlursSerializer::class)
public sealed class Blurs(
  override val `value`: String,
) : AtpEnum() {
  public data object Content : Blurs("content")

  public data object Media : Blurs("media")

  public data object None : Blurs("none")

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

  public companion object {
    public fun safeValueOf(`value`: String): Blurs = when (value) {
      "content" -> Content
      "media" -> Media
      "none" -> None
      else -> Unknown(value)
    }
  }
}

public class DefaultSettingSerializer : KSerializer by stringEnumSerializer(DefaultSetting::safeValueOf)

/**
 * The default setting for this label.
 */
@Serializable(with = DefaultSettingSerializer::class)
public sealed class DefaultSetting(
  override val `value`: String,
) : AtpEnum() {
  public data object Ignore : DefaultSetting("ignore")

  public data object Warn : DefaultSetting("warn")

  public data object Hide : DefaultSetting("hide")

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

  public companion object {
    public fun safeValueOf(`value`: String): DefaultSetting = when (value) {
      "ignore" -> Ignore
      "warn" -> Warn
      "hide" -> Hide
      else -> Unknown(value)
    }
  }
}

public class LabelValueSerializer : KSerializer by stringEnumSerializer(LabelValue::safeValueOf)

@Serializable(with = LabelValueSerializer::class)
public sealed class LabelValue(
  override val `value`: String,
) : AtpEnum() {
  public data object Hide : LabelValue("!hide")

  public data object NoPromote : LabelValue("!no-promote")

  public data object Warn : LabelValue("!warn")

  public data object NoUnauthenticated : LabelValue("!no-unauthenticated")

  public data object DmcaViolation : LabelValue("dmca-violation")

  public data object Doxxing : LabelValue("doxxing")

  public data object Porn : LabelValue("porn")

  public data object Sexual : LabelValue("sexual")

  public data object Nudity : LabelValue("nudity")

  public data object Nsfl : LabelValue("nsfl")

  public data object Gore : LabelValue("gore")

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

  public companion object {
    public fun safeValueOf(`value`: String): LabelValue = when (value) {
      "!hide" -> Hide
      "!no-promote" -> NoPromote
      "!warn" -> Warn
      "!no-unauthenticated" -> NoUnauthenticated
      "dmca-violation" -> DmcaViolation
      "doxxing" -> Doxxing
      "porn" -> Porn
      "sexual" -> Sexual
      "nudity" -> Nudity
      "nsfl" -> Nsfl
      "gore" -> Gore
      else -> Unknown(value)
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy