// Autogenerated from Pigeon (v26.3.4), do not edit directly.
// See also: https://pub.dev/packages/pigeon

import Foundation

#if os(iOS)
  import Flutter
#elseif os(macOS)
  import FlutterMacOS
#else
  #error("Unsupported platform.")
#endif

/// Error class for passing custom error details to Dart side.
final class PigeonError: Error {
  let code: String
  let message: String?
  let details: Sendable?

  init(code: String, message: String?, details: Sendable?) {
    self.code = code
    self.message = message
    self.details = details
  }

  var localizedDescription: String {
    return
      "PigeonError(code: \(code), message: \(message ?? "<nil>"), details: \(details ?? "<nil>")"
  }
}

private func wrapResult(_ result: Any?) -> [Any?] {
  return [result]
}

private func wrapError(_ error: Any) -> [Any?] {
  if let pigeonError = error as? PigeonError {
    return [
      pigeonError.code,
      pigeonError.message,
      pigeonError.details,
    ]
  }
  if let flutterError = error as? FlutterError {
    return [
      flutterError.code,
      flutterError.message,
      flutterError.details,
    ]
  }
  return [
    "\(error)",
    "\(Swift.type(of: error))",
    "Stacktrace: \(Thread.callStackSymbols)",
  ]
}

private func isNullish(_ value: Any?) -> Bool {
  return value is NSNull || value == nil
}

private func nilOrValue<T>(_ value: Any?) -> T? {
  if value is NSNull { return nil }
  return value as! T?
}

private func doubleEqualsMessages(_ lhs: Double, _ rhs: Double) -> Bool {
  return (lhs.isNaN && rhs.isNaN) || lhs == rhs
}

private func doubleHashMessages(_ value: Double, _ hasher: inout Hasher) {
  if value.isNaN {
    hasher.combine(0x7FF8000000000000)
  } else {
    // Normalize -0.0 to 0.0
    hasher.combine(value == 0 ? 0 : value)
  }
}

func deepEqualsMessages(_ lhs: Any?, _ rhs: Any?) -> Bool {
  let cleanLhs = nilOrValue(lhs) as Any?
  let cleanRhs = nilOrValue(rhs) as Any?
  switch (cleanLhs, cleanRhs) {
  case (nil, nil):
    return true

  case (nil, _), (_, nil):
    return false

  case (let lhs as AnyObject, let rhs as AnyObject) where lhs === rhs:
    return true

  case is (Void, Void):
    return true

  case (let lhsArray, let rhsArray) as ([Any?], [Any?]):
    guard lhsArray.count == rhsArray.count else { return false }
    for (index, element) in lhsArray.enumerated() {
      if !deepEqualsMessages(element, rhsArray[index]) {
        return false
      }
    }
    return true

  case (let lhsArray, let rhsArray) as ([Double], [Double]):
    guard lhsArray.count == rhsArray.count else { return false }
    for (index, element) in lhsArray.enumerated() {
      if !doubleEqualsMessages(element, rhsArray[index]) {
        return false
      }
    }
    return true

  case (let lhsDictionary, let rhsDictionary) as ([AnyHashable: Any?], [AnyHashable: Any?]):
    guard lhsDictionary.count == rhsDictionary.count else { return false }
    for (lhsKey, lhsValue) in lhsDictionary {
      var found = false
      for (rhsKey, rhsValue) in rhsDictionary {
        if deepEqualsMessages(lhsKey, rhsKey) {
          if deepEqualsMessages(lhsValue, rhsValue) {
            found = true
            break
          } else {
            return false
          }
        }
      }
      if !found { return false }
    }
    return true

  case (let lhs as Double, let rhs as Double):
    return doubleEqualsMessages(lhs, rhs)

  case (let lhsHashable, let rhsHashable) as (AnyHashable, AnyHashable):
    return lhsHashable == rhsHashable

  default:
    return false
  }
}

func deepHashMessages(value: Any?, hasher: inout Hasher) {
  let cleanValue = nilOrValue(value) as Any?
  if let cleanValue = cleanValue {
    if let doubleValue = cleanValue as? Double {
      doubleHashMessages(doubleValue, &hasher)
    } else if let valueList = cleanValue as? [Any?] {
      for item in valueList {
        deepHashMessages(value: item, hasher: &hasher)
      }
    } else if let valueList = cleanValue as? [Double] {
      for item in valueList {
        doubleHashMessages(item, &hasher)
      }
    } else if let valueDict = cleanValue as? [AnyHashable: Any?] {
      var result = 0
      for (key, value) in valueDict {
        var entryKeyHasher = Hasher()
        deepHashMessages(value: key, hasher: &entryKeyHasher)
        var entryValueHasher = Hasher()
        deepHashMessages(value: value, hasher: &entryValueHasher)
        result = result &+ ((entryKeyHasher.finalize() &* 31) ^ entryValueHasher.finalize())
      }
      hasher.combine(result)
    } else if let hashableValue = cleanValue as? AnyHashable {
      hasher.combine(hashableValue)
    } else {
      hasher.combine(String(describing: cleanValue))
    }
  } else {
    hasher.combine(0)
  }
}


enum PlatformAssetPlaybackStyle: Int {
  case unknown = 0
  case image = 1
  case video = 2
  case imageAnimated = 3
  case livePhoto = 4
  case videoLooping = 5
}

/// Generated class from Pigeon that represents data sent in messages.
struct PlatformAsset: Hashable {
  var id: String
  var name: String
  var type: Int64
  var createdAt: Int64? = nil
  var updatedAt: Int64? = nil
  var width: Int64? = nil
  var height: Int64? = nil
  var durationMs: Int64
  var orientation: Int64
  var isFavorite: Bool
  var adjustmentTime: Int64? = nil
  var latitude: Double? = nil
  var longitude: Double? = nil
  var playbackStyle: PlatformAssetPlaybackStyle


  // swift-format-ignore: AlwaysUseLowerCamelCase
  static func fromList(_ pigeonVar_list: [Any?]) -> PlatformAsset? {
    let id = pigeonVar_list[0] as! String
    let name = pigeonVar_list[1] as! String
    let type = pigeonVar_list[2] as! Int64
    let createdAt: Int64? = nilOrValue(pigeonVar_list[3])
    let updatedAt: Int64? = nilOrValue(pigeonVar_list[4])
    let width: Int64? = nilOrValue(pigeonVar_list[5])
    let height: Int64? = nilOrValue(pigeonVar_list[6])
    let durationMs = pigeonVar_list[7] as! Int64
    let orientation = pigeonVar_list[8] as! Int64
    let isFavorite = pigeonVar_list[9] as! Bool
    let adjustmentTime: Int64? = nilOrValue(pigeonVar_list[10])
    let latitude: Double? = nilOrValue(pigeonVar_list[11])
    let longitude: Double? = nilOrValue(pigeonVar_list[12])
    let playbackStyle = pigeonVar_list[13] as! PlatformAssetPlaybackStyle

    return PlatformAsset(
      id: id,
      name: name,
      type: type,
      createdAt: createdAt,
      updatedAt: updatedAt,
      width: width,
      height: height,
      durationMs: durationMs,
      orientation: orientation,
      isFavorite: isFavorite,
      adjustmentTime: adjustmentTime,
      latitude: latitude,
      longitude: longitude,
      playbackStyle: playbackStyle
    )
  }
  func toList() -> [Any?] {
    return [
      id,
      name,
      type,
      createdAt,
      updatedAt,
      width,
      height,
      durationMs,
      orientation,
      isFavorite,
      adjustmentTime,
      latitude,
      longitude,
      playbackStyle,
    ]
  }
  static func == (lhs: PlatformAsset, rhs: PlatformAsset) -> Bool {
    if Swift.type(of: lhs) != Swift.type(of: rhs) {
      return false
    }
    return deepEqualsMessages(lhs.id, rhs.id) && deepEqualsMessages(lhs.name, rhs.name) && deepEqualsMessages(lhs.type, rhs.type) && deepEqualsMessages(lhs.createdAt, rhs.createdAt) && deepEqualsMessages(lhs.updatedAt, rhs.updatedAt) && deepEqualsMessages(lhs.width, rhs.width) && deepEqualsMessages(lhs.height, rhs.height) && deepEqualsMessages(lhs.durationMs, rhs.durationMs) && deepEqualsMessages(lhs.orientation, rhs.orientation) && deepEqualsMessages(lhs.isFavorite, rhs.isFavorite) && deepEqualsMessages(lhs.adjustmentTime, rhs.adjustmentTime) && deepEqualsMessages(lhs.latitude, rhs.latitude) && deepEqualsMessages(lhs.longitude, rhs.longitude) && deepEqualsMessages(lhs.playbackStyle, rhs.playbackStyle)
  }

  func hash(into hasher: inout Hasher) {
    hasher.combine("PlatformAsset")
    deepHashMessages(value: id, hasher: &hasher)
    deepHashMessages(value: name, hasher: &hasher)
    deepHashMessages(value: type, hasher: &hasher)
    deepHashMessages(value: createdAt, hasher: &hasher)
    deepHashMessages(value: updatedAt, hasher: &hasher)
    deepHashMessages(value: width, hasher: &hasher)
    deepHashMessages(value: height, hasher: &hasher)
    deepHashMessages(value: durationMs, hasher: &hasher)
    deepHashMessages(value: orientation, hasher: &hasher)
    deepHashMessages(value: isFavorite, hasher: &hasher)
    deepHashMessages(value: adjustmentTime, hasher: &hasher)
    deepHashMessages(value: latitude, hasher: &hasher)
    deepHashMessages(value: longitude, hasher: &hasher)
    deepHashMessages(value: playbackStyle, hasher: &hasher)
  }
}

/// Generated class from Pigeon that represents data sent in messages.
struct PlatformAlbum: Hashable {
  var id: String
  var name: String
  var updatedAt: Int64? = nil
  var isCloud: Bool
  var assetCount: Int64


  // swift-format-ignore: AlwaysUseLowerCamelCase
  static func fromList(_ pigeonVar_list: [Any?]) -> PlatformAlbum? {
    let id = pigeonVar_list[0] as! String
    let name = pigeonVar_list[1] as! String
    let updatedAt: Int64? = nilOrValue(pigeonVar_list[2])
    let isCloud = pigeonVar_list[3] as! Bool
    let assetCount = pigeonVar_list[4] as! Int64

    return PlatformAlbum(
      id: id,
      name: name,
      updatedAt: updatedAt,
      isCloud: isCloud,
      assetCount: assetCount
    )
  }
  func toList() -> [Any?] {
    return [
      id,
      name,
      updatedAt,
      isCloud,
      assetCount,
    ]
  }
  static func == (lhs: PlatformAlbum, rhs: PlatformAlbum) -> Bool {
    if Swift.type(of: lhs) != Swift.type(of: rhs) {
      return false
    }
    return deepEqualsMessages(lhs.id, rhs.id) && deepEqualsMessages(lhs.name, rhs.name) && deepEqualsMessages(lhs.updatedAt, rhs.updatedAt) && deepEqualsMessages(lhs.isCloud, rhs.isCloud) && deepEqualsMessages(lhs.assetCount, rhs.assetCount)
  }

  func hash(into hasher: inout Hasher) {
    hasher.combine("PlatformAlbum")
    deepHashMessages(value: id, hasher: &hasher)
    deepHashMessages(value: name, hasher: &hasher)
    deepHashMessages(value: updatedAt, hasher: &hasher)
    deepHashMessages(value: isCloud, hasher: &hasher)
    deepHashMessages(value: assetCount, hasher: &hasher)
  }
}

/// Generated class from Pigeon that represents data sent in messages.
struct SyncDelta: Hashable {
  var hasChanges: Bool
  var updates: [PlatformAsset]
  var deletes: [String]
  var assetAlbums: [String: [String]]


  // swift-format-ignore: AlwaysUseLowerCamelCase
  static func fromList(_ pigeonVar_list: [Any?]) -> SyncDelta? {
    let hasChanges = pigeonVar_list[0] as! Bool
    let updates = pigeonVar_list[1] as! [PlatformAsset]
    let deletes = pigeonVar_list[2] as! [String]
    let assetAlbums = pigeonVar_list[3] as! [String: [String]]

    return SyncDelta(
      hasChanges: hasChanges,
      updates: updates,
      deletes: deletes,
      assetAlbums: assetAlbums
    )
  }
  func toList() -> [Any?] {
    return [
      hasChanges,
      updates,
      deletes,
      assetAlbums,
    ]
  }
  static func == (lhs: SyncDelta, rhs: SyncDelta) -> Bool {
    if Swift.type(of: lhs) != Swift.type(of: rhs) {
      return false
    }
    return deepEqualsMessages(lhs.hasChanges, rhs.hasChanges) && deepEqualsMessages(lhs.updates, rhs.updates) && deepEqualsMessages(lhs.deletes, rhs.deletes) && deepEqualsMessages(lhs.assetAlbums, rhs.assetAlbums)
  }

  func hash(into hasher: inout Hasher) {
    hasher.combine("SyncDelta")
    deepHashMessages(value: hasChanges, hasher: &hasher)
    deepHashMessages(value: updates, hasher: &hasher)
    deepHashMessages(value: deletes, hasher: &hasher)
    deepHashMessages(value: assetAlbums, hasher: &hasher)
  }
}

/// Generated class from Pigeon that represents data sent in messages.
struct HashResult: Hashable {
  var assetId: String
  var error: String? = nil
  var hash: String? = nil


  // swift-format-ignore: AlwaysUseLowerCamelCase
  static func fromList(_ pigeonVar_list: [Any?]) -> HashResult? {
    let assetId = pigeonVar_list[0] as! String
    let error: String? = nilOrValue(pigeonVar_list[1])
    let hash: String? = nilOrValue(pigeonVar_list[2])

    return HashResult(
      assetId: assetId,
      error: error,
      hash: hash
    )
  }
  func toList() -> [Any?] {
    return [
      assetId,
      error,
      hash,
    ]
  }
  static func == (lhs: HashResult, rhs: HashResult) -> Bool {
    if Swift.type(of: lhs) != Swift.type(of: rhs) {
      return false
    }
    return deepEqualsMessages(lhs.assetId, rhs.assetId) && deepEqualsMessages(lhs.error, rhs.error) && deepEqualsMessages(lhs.hash, rhs.hash)
  }

  func hash(into hasher: inout Hasher) {
    hasher.combine("HashResult")
    deepHashMessages(value: assetId, hasher: &hasher)
    deepHashMessages(value: error, hasher: &hasher)
    deepHashMessages(value: hash, hasher: &hasher)
  }
}

/// Generated class from Pigeon that represents data sent in messages.
struct CloudIdResult: Hashable {
  var assetId: String
  var error: String? = nil
  var cloudId: String? = nil


  // swift-format-ignore: AlwaysUseLowerCamelCase
  static func fromList(_ pigeonVar_list: [Any?]) -> CloudIdResult? {
    let assetId = pigeonVar_list[0] as! String
    let error: String? = nilOrValue(pigeonVar_list[1])
    let cloudId: String? = nilOrValue(pigeonVar_list[2])

    return CloudIdResult(
      assetId: assetId,
      error: error,
      cloudId: cloudId
    )
  }
  func toList() -> [Any?] {
    return [
      assetId,
      error,
      cloudId,
    ]
  }
  static func == (lhs: CloudIdResult, rhs: CloudIdResult) -> Bool {
    if Swift.type(of: lhs) != Swift.type(of: rhs) {
      return false
    }
    return deepEqualsMessages(lhs.assetId, rhs.assetId) && deepEqualsMessages(lhs.error, rhs.error) && deepEqualsMessages(lhs.cloudId, rhs.cloudId)
  }

  func hash(into hasher: inout Hasher) {
    hasher.combine("CloudIdResult")
    deepHashMessages(value: assetId, hasher: &hasher)
    deepHashMessages(value: error, hasher: &hasher)
    deepHashMessages(value: cloudId, hasher: &hasher)
  }
}

private class MessagesPigeonCodecReader: FlutterStandardReader {
  override func readValue(ofType type: UInt8) -> Any? {
    switch type {
    case 129:
      let enumResultAsInt: Int? = nilOrValue(self.readValue() as! Int?)
      if let enumResultAsInt = enumResultAsInt {
        return PlatformAssetPlaybackStyle(rawValue: enumResultAsInt)
      }
      return nil
    case 130:
      return PlatformAsset.fromList(self.readValue() as! [Any?])
    case 131:
      return PlatformAlbum.fromList(self.readValue() as! [Any?])
    case 132:
      return SyncDelta.fromList(self.readValue() as! [Any?])
    case 133:
      return HashResult.fromList(self.readValue() as! [Any?])
    case 134:
      return CloudIdResult.fromList(self.readValue() as! [Any?])
    default:
      return super.readValue(ofType: type)
    }
  }
}

private class MessagesPigeonCodecWriter: FlutterStandardWriter {
  override func writeValue(_ value: Any) {
    if let value = value as? PlatformAssetPlaybackStyle {
      super.writeByte(129)
      super.writeValue(value.rawValue)
    } else if let value = value as? PlatformAsset {
      super.writeByte(130)
      super.writeValue(value.toList())
    } else if let value = value as? PlatformAlbum {
      super.writeByte(131)
      super.writeValue(value.toList())
    } else if let value = value as? SyncDelta {
      super.writeByte(132)
      super.writeValue(value.toList())
    } else if let value = value as? HashResult {
      super.writeByte(133)
      super.writeValue(value.toList())
    } else if let value = value as? CloudIdResult {
      super.writeByte(134)
      super.writeValue(value.toList())
    } else {
      super.writeValue(value)
    }
  }
}

private class MessagesPigeonCodecReaderWriter: FlutterStandardReaderWriter {
  override func reader(with data: Data) -> FlutterStandardReader {
    return MessagesPigeonCodecReader(data: data)
  }

  override func writer(with data: NSMutableData) -> FlutterStandardWriter {
    return MessagesPigeonCodecWriter(data: data)
  }
}

class MessagesPigeonCodec: FlutterStandardMessageCodec, @unchecked Sendable {
  static let shared = MessagesPigeonCodec(readerWriter: MessagesPigeonCodecReaderWriter())
}


/// Generated protocol from Pigeon that represents a handler of messages from Flutter.
protocol NativeSyncApi {
  func shouldFullSync(completion: @escaping (Result<Bool, Error>) -> Void)
  func getMediaChanges(completion: @escaping (Result<SyncDelta, Error>) -> Void)
  func checkpointSync() throws
  func clearSyncCheckpoint() throws
  func getAssetIdsForAlbum(albumId: String, completion: @escaping (Result<[String], Error>) -> Void)
  func getAlbums(completion: @escaping (Result<[PlatformAlbum], Error>) -> Void)
  func getAssetsCountSince(albumId: String, timestamp: Int64) throws -> Int64
  func getAssetsForAlbum(albumId: String, updatedTimeCond: Int64?, completion: @escaping (Result<[PlatformAsset], Error>) -> Void)
  func hashAssets(assetIds: [String], allowNetworkAccess: Bool, completion: @escaping (Result<[HashResult], Error>) -> Void)
  func cancelHashing() throws
  func cancelSync() throws
  func getTrashedAssets() throws -> [String: [PlatformAsset]]
  func restoreFromTrashById(mediaId: String, type: Int64, completion: @escaping (Result<Bool, Error>) -> Void)
  func getCloudIdForAssetIds(assetIds: [String]) throws -> [CloudIdResult]
}

/// Generated setup class from Pigeon to handle messages through the `binaryMessenger`.
class NativeSyncApiSetup {
  static var codec: FlutterStandardMessageCodec { MessagesPigeonCodec.shared }
  /// Sets up an instance of `NativeSyncApi` to handle messages through the `binaryMessenger`.
  static func setUp(binaryMessenger: FlutterBinaryMessenger, api: NativeSyncApi?, messageChannelSuffix: String = "") {
    let channelSuffix = messageChannelSuffix.count > 0 ? ".\(messageChannelSuffix)" : ""
    #if os(iOS)
      let taskQueue = binaryMessenger.makeBackgroundTaskQueue?()
    #else
      let taskQueue: FlutterTaskQueue? = nil
    #endif
    let shouldFullSyncChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.immich_mobile.NativeSyncApi.shouldFullSync\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec)
    if let api = api {
      shouldFullSyncChannel.setMessageHandler { _, reply in
        api.shouldFullSync { result in
          switch result {
          case .success(let res):
            reply(wrapResult(res))
          case .failure(let error):
            reply(wrapError(error))
          }
        }
      }
    } else {
      shouldFullSyncChannel.setMessageHandler(nil)
    }
    let getMediaChangesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.immich_mobile.NativeSyncApi.getMediaChanges\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec)
    if let api = api {
      getMediaChangesChannel.setMessageHandler { _, reply in
        api.getMediaChanges { result in
          switch result {
          case .success(let res):
            reply(wrapResult(res))
          case .failure(let error):
            reply(wrapError(error))
          }
        }
      }
    } else {
      getMediaChangesChannel.setMessageHandler(nil)
    }
    let checkpointSyncChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.immich_mobile.NativeSyncApi.checkpointSync\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec)
    if let api = api {
      checkpointSyncChannel.setMessageHandler { _, reply in
        do {
          try api.checkpointSync()
          reply(wrapResult(nil))
        } catch {
          reply(wrapError(error))
        }
      }
    } else {
      checkpointSyncChannel.setMessageHandler(nil)
    }
    let clearSyncCheckpointChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.immich_mobile.NativeSyncApi.clearSyncCheckpoint\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec)
    if let api = api {
      clearSyncCheckpointChannel.setMessageHandler { _, reply in
        do {
          try api.clearSyncCheckpoint()
          reply(wrapResult(nil))
        } catch {
          reply(wrapError(error))
        }
      }
    } else {
      clearSyncCheckpointChannel.setMessageHandler(nil)
    }
    let getAssetIdsForAlbumChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.immich_mobile.NativeSyncApi.getAssetIdsForAlbum\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec)
    if let api = api {
      getAssetIdsForAlbumChannel.setMessageHandler { message, reply in
        let args = message as! [Any?]
        let albumIdArg = args[0] as! String
        api.getAssetIdsForAlbum(albumId: albumIdArg) { result in
          switch result {
          case .success(let res):
            reply(wrapResult(res))
          case .failure(let error):
            reply(wrapError(error))
          }
        }
      }
    } else {
      getAssetIdsForAlbumChannel.setMessageHandler(nil)
    }
    let getAlbumsChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.immich_mobile.NativeSyncApi.getAlbums\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec)
    if let api = api {
      getAlbumsChannel.setMessageHandler { _, reply in
        api.getAlbums { result in
          switch result {
          case .success(let res):
            reply(wrapResult(res))
          case .failure(let error):
            reply(wrapError(error))
          }
        }
      }
    } else {
      getAlbumsChannel.setMessageHandler(nil)
    }
    let getAssetsCountSinceChannel = taskQueue == nil
      ? FlutterBasicMessageChannel(name: "dev.flutter.pigeon.immich_mobile.NativeSyncApi.getAssetsCountSince\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec)
      : FlutterBasicMessageChannel(name: "dev.flutter.pigeon.immich_mobile.NativeSyncApi.getAssetsCountSince\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec, taskQueue: taskQueue)
    if let api = api {
      getAssetsCountSinceChannel.setMessageHandler { message, reply in
        let args = message as! [Any?]
        let albumIdArg = args[0] as! String
        let timestampArg = args[1] as! Int64
        do {
          let result = try api.getAssetsCountSince(albumId: albumIdArg, timestamp: timestampArg)
          reply(wrapResult(result))
        } catch {
          reply(wrapError(error))
        }
      }
    } else {
      getAssetsCountSinceChannel.setMessageHandler(nil)
    }
    let getAssetsForAlbumChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.immich_mobile.NativeSyncApi.getAssetsForAlbum\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec)
    if let api = api {
      getAssetsForAlbumChannel.setMessageHandler { message, reply in
        let args = message as! [Any?]
        let albumIdArg = args[0] as! String
        let updatedTimeCondArg: Int64? = nilOrValue(args[1])
        api.getAssetsForAlbum(albumId: albumIdArg, updatedTimeCond: updatedTimeCondArg) { result in
          switch result {
          case .success(let res):
            reply(wrapResult(res))
          case .failure(let error):
            reply(wrapError(error))
          }
        }
      }
    } else {
      getAssetsForAlbumChannel.setMessageHandler(nil)
    }
    let hashAssetsChannel = taskQueue == nil
      ? FlutterBasicMessageChannel(name: "dev.flutter.pigeon.immich_mobile.NativeSyncApi.hashAssets\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec)
      : FlutterBasicMessageChannel(name: "dev.flutter.pigeon.immich_mobile.NativeSyncApi.hashAssets\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec, taskQueue: taskQueue)
    if let api = api {
      hashAssetsChannel.setMessageHandler { message, reply in
        let args = message as! [Any?]
        let assetIdsArg = args[0] as! [String]
        let allowNetworkAccessArg = args[1] as! Bool
        api.hashAssets(assetIds: assetIdsArg, allowNetworkAccess: allowNetworkAccessArg) { result in
          switch result {
          case .success(let res):
            reply(wrapResult(res))
          case .failure(let error):
            reply(wrapError(error))
          }
        }
      }
    } else {
      hashAssetsChannel.setMessageHandler(nil)
    }
    let cancelHashingChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.immich_mobile.NativeSyncApi.cancelHashing\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec)
    if let api = api {
      cancelHashingChannel.setMessageHandler { _, reply in
        do {
          try api.cancelHashing()
          reply(wrapResult(nil))
        } catch {
          reply(wrapError(error))
        }
      }
    } else {
      cancelHashingChannel.setMessageHandler(nil)
    }
    let cancelSyncChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.immich_mobile.NativeSyncApi.cancelSync\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec)
    if let api = api {
      cancelSyncChannel.setMessageHandler { _, reply in
        do {
          try api.cancelSync()
          reply(wrapResult(nil))
        } catch {
          reply(wrapError(error))
        }
      }
    } else {
      cancelSyncChannel.setMessageHandler(nil)
    }
    let getTrashedAssetsChannel = taskQueue == nil
      ? FlutterBasicMessageChannel(name: "dev.flutter.pigeon.immich_mobile.NativeSyncApi.getTrashedAssets\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec)
      : FlutterBasicMessageChannel(name: "dev.flutter.pigeon.immich_mobile.NativeSyncApi.getTrashedAssets\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec, taskQueue: taskQueue)
    if let api = api {
      getTrashedAssetsChannel.setMessageHandler { _, reply in
        do {
          let result = try api.getTrashedAssets()
          reply(wrapResult(result))
        } catch {
          reply(wrapError(error))
        }
      }
    } else {
      getTrashedAssetsChannel.setMessageHandler(nil)
    }
    let restoreFromTrashByIdChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.immich_mobile.NativeSyncApi.restoreFromTrashById\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec)
    if let api = api {
      restoreFromTrashByIdChannel.setMessageHandler { message, reply in
        let args = message as! [Any?]
        let mediaIdArg = args[0] as! String
        let typeArg = args[1] as! Int64
        api.restoreFromTrashById(mediaId: mediaIdArg, type: typeArg) { result in
          switch result {
          case .success(let res):
            reply(wrapResult(res))
          case .failure(let error):
            reply(wrapError(error))
          }
        }
      }
    } else {
      restoreFromTrashByIdChannel.setMessageHandler(nil)
    }
    let getCloudIdForAssetIdsChannel = taskQueue == nil
      ? FlutterBasicMessageChannel(name: "dev.flutter.pigeon.immich_mobile.NativeSyncApi.getCloudIdForAssetIds\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec)
      : FlutterBasicMessageChannel(name: "dev.flutter.pigeon.immich_mobile.NativeSyncApi.getCloudIdForAssetIds\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec, taskQueue: taskQueue)
    if let api = api {
      getCloudIdForAssetIdsChannel.setMessageHandler { message, reply in
        let args = message as! [Any?]
        let assetIdsArg = args[0] as! [String]
        do {
          let result = try api.getCloudIdForAssetIds(assetIds: assetIdsArg)
          reply(wrapResult(result))
        } catch {
          reply(wrapError(error))
        }
      }
    } else {
      getCloudIdForAssetIdsChannel.setMessageHandler(nil)
    }
  }
}
