// Autogenerated from Pigeon (v26.0.1), do not edit directly.
// See also: https://pub.dev/packages/pigeon
@file:Suppress("UNCHECKED_CAST", "ArrayInDataClass")


import android.util.Log
import io.flutter.plugin.common.BasicMessageChannel
import io.flutter.plugin.common.BinaryMessenger
import io.flutter.plugin.common.EventChannel
import io.flutter.plugin.common.MessageCodec
import io.flutter.plugin.common.StandardMethodCodec
import io.flutter.plugin.common.StandardMessageCodec
import java.io.ByteArrayOutputStream
import java.nio.ByteBuffer
private object PlayerSettingsHelperPigeonUtils {

  fun wrapResult(result: Any?): List<Any?> {
    return listOf(result)
  }

  fun wrapError(exception: Throwable): List<Any?> {
    return if (exception is FlutterError) {
      listOf(
        exception.code,
        exception.message,
        exception.details
      )
    } else {
      listOf(
        exception.javaClass.simpleName,
        exception.toString(),
        "Cause: " + exception.cause + ", Stacktrace: " + Log.getStackTraceString(exception)
      )
    }
  }
  fun deepEquals(a: Any?, b: Any?): Boolean {
    if (a is ByteArray && b is ByteArray) {
        return a.contentEquals(b)
    }
    if (a is IntArray && b is IntArray) {
        return a.contentEquals(b)
    }
    if (a is LongArray && b is LongArray) {
        return a.contentEquals(b)
    }
    if (a is DoubleArray && b is DoubleArray) {
        return a.contentEquals(b)
    }
    if (a is Array<*> && b is Array<*>) {
      return a.size == b.size &&
          a.indices.all{ deepEquals(a[it], b[it]) }
    }
    if (a is List<*> && b is List<*>) {
      return a.size == b.size &&
          a.indices.all{ deepEquals(a[it], b[it]) }
    }
    if (a is Map<*, *> && b is Map<*, *>) {
      return a.size == b.size && a.all {
          (b as Map<Any?, Any?>).containsKey(it.key) &&
          deepEquals(it.value, b[it.key])
      }
    }
    return a == b
  }
      
}

enum class SegmentType(val raw: Int) {
  COMMERCIAL(0),
  PREVIEW(1),
  RECAP(2),
  INTRO(3),
  OUTRO(4);

  companion object {
    fun ofRaw(raw: Int): SegmentType? {
      return values().firstOrNull { it.raw == raw }
    }
  }
}

enum class SegmentSkip(val raw: Int) {
  ASK(0),
  SKIP(1),
  NONE(2);

  companion object {
    fun ofRaw(raw: Int): SegmentSkip? {
      return values().firstOrNull { it.raw == raw }
    }
  }
}

/** Generated class from Pigeon that represents data sent in messages. */
data class PlayerSettings (
  val enableTunneling: Boolean,
  val skipTypes: Map<SegmentType, SegmentSkip>,
  val themeColor: Long? = null,
  val skipForward: Long,
  val skipBackward: Long
)
 {
  companion object {
    fun fromList(pigeonVar_list: List<Any?>): PlayerSettings {
      val enableTunneling = pigeonVar_list[0] as Boolean
      val skipTypes = pigeonVar_list[1] as Map<SegmentType, SegmentSkip>
      val themeColor = pigeonVar_list[2] as Long?
      val skipForward = pigeonVar_list[3] as Long
      val skipBackward = pigeonVar_list[4] as Long
      return PlayerSettings(enableTunneling, skipTypes, themeColor, skipForward, skipBackward)
    }
  }
  fun toList(): List<Any?> {
    return listOf(
      enableTunneling,
      skipTypes,
      themeColor,
      skipForward,
      skipBackward,
    )
  }
  override fun equals(other: Any?): Boolean {
    if (other !is PlayerSettings) {
      return false
    }
    if (this === other) {
      return true
    }
    return PlayerSettingsHelperPigeonUtils.deepEquals(toList(), other.toList())  }

  override fun hashCode(): Int = toList().hashCode()
}
private open class PlayerSettingsHelperPigeonCodec : StandardMessageCodec() {
  override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? {
    return when (type) {
      129.toByte() -> {
        return (readValue(buffer) as Long?)?.let {
          SegmentType.ofRaw(it.toInt())
        }
      }
      130.toByte() -> {
        return (readValue(buffer) as Long?)?.let {
          SegmentSkip.ofRaw(it.toInt())
        }
      }
      131.toByte() -> {
        return (readValue(buffer) as? List<Any?>)?.let {
          PlayerSettings.fromList(it)
        }
      }
      else -> super.readValueOfType(type, buffer)
    }
  }
  override fun writeValue(stream: ByteArrayOutputStream, value: Any?)   {
    when (value) {
      is SegmentType -> {
        stream.write(129)
        writeValue(stream, value.raw)
      }
      is SegmentSkip -> {
        stream.write(130)
        writeValue(stream, value.raw)
      }
      is PlayerSettings -> {
        stream.write(131)
        writeValue(stream, value.toList())
      }
      else -> super.writeValue(stream, value)
    }
  }
}

/** Generated interface from Pigeon that represents a handler of messages from Flutter. */
interface PlayerSettingsPigeon {
  fun sendPlayerSettings(playerSettings: PlayerSettings)

  companion object {
    /** The codec used by PlayerSettingsPigeon. */
    val codec: MessageCodec<Any?> by lazy {
      PlayerSettingsHelperPigeonCodec()
    }
    /** Sets up an instance of `PlayerSettingsPigeon` to handle messages through the `binaryMessenger`. */
    @JvmOverloads
    fun setUp(binaryMessenger: BinaryMessenger, api: PlayerSettingsPigeon?, messageChannelSuffix: String = "") {
      val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else ""
      run {
        val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.nl_jknaapen_fladder.settings.PlayerSettingsPigeon.sendPlayerSettings$separatedMessageChannelSuffix", codec)
        if (api != null) {
          channel.setMessageHandler { message, reply ->
            val args = message as List<Any?>
            val playerSettingsArg = args[0] as PlayerSettings
            val wrapped: List<Any?> = try {
              api.sendPlayerSettings(playerSettingsArg)
              listOf(null)
            } catch (exception: Throwable) {
              PlayerSettingsHelperPigeonUtils.wrapError(exception)
            }
            reply.reply(wrapped)
          }
        } else {
          channel.setMessageHandler(null)
        }
      }
    }
  }
}
