///
/// BackgroundSessionOptions.swift
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
/// https://github.com/mrousavy/nitro
/// Copyright © Marc Rousavy @ Margelo
///

import NitroModules

/**
 * Represents an instance of `BackgroundSessionOptions`, backed by a C++ struct.
 */
public typealias BackgroundSessionOptions = margelo.nitro.munimbluetooth.BackgroundSessionOptions

public extension BackgroundSessionOptions {
  private typealias bridge = margelo.nitro.munimbluetooth.bridge.swift

  /**
   * Create a new instance of `BackgroundSessionOptions`.
   */
  init(serviceUUIDs: [String], localName: String?, allowDuplicates: Bool?, scanMode: ScanMode?, androidNotificationChannelId: String?, androidNotificationChannelName: String?, androidNotificationTitle: String?, androidNotificationText: String?) {
    self.init({ () -> bridge.std__vector_std__string_ in
      var __vector = bridge.create_std__vector_std__string_(serviceUUIDs.count)
      for __item in serviceUUIDs {
        __vector.push_back(std.string(__item))
      }
      return __vector
    }(), { () -> bridge.std__optional_std__string_ in
      if let __unwrappedValue = localName {
        return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_bool_ in
      if let __unwrappedValue = allowDuplicates {
        return bridge.create_std__optional_bool_(__unwrappedValue)
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_ScanMode_ in
      if let __unwrappedValue = scanMode {
        return bridge.create_std__optional_ScanMode_(__unwrappedValue)
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_std__string_ in
      if let __unwrappedValue = androidNotificationChannelId {
        return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_std__string_ in
      if let __unwrappedValue = androidNotificationChannelName {
        return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_std__string_ in
      if let __unwrappedValue = androidNotificationTitle {
        return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_std__string_ in
      if let __unwrappedValue = androidNotificationText {
        return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
      } else {
        return .init()
      }
    }())
  }

  @inline(__always)
  var serviceUUIDs: [String] {
    return self.__serviceUUIDs.map({ __item in String(__item) })
  }
  
  @inline(__always)
  var localName: String? {
    return { () -> String? in
      if bridge.has_value_std__optional_std__string_(self.__localName) {
        let __unwrapped = bridge.get_std__optional_std__string_(self.__localName)
        return String(__unwrapped)
      } else {
        return nil
      }
    }()
  }
  
  @inline(__always)
  var allowDuplicates: Bool? {
    return { () -> Bool? in
      if bridge.has_value_std__optional_bool_(self.__allowDuplicates) {
        let __unwrapped = bridge.get_std__optional_bool_(self.__allowDuplicates)
        return __unwrapped
      } else {
        return nil
      }
    }()
  }
  
  @inline(__always)
  var scanMode: ScanMode? {
    return self.__scanMode.value
  }
  
  @inline(__always)
  var androidNotificationChannelId: String? {
    return { () -> String? in
      if bridge.has_value_std__optional_std__string_(self.__androidNotificationChannelId) {
        let __unwrapped = bridge.get_std__optional_std__string_(self.__androidNotificationChannelId)
        return String(__unwrapped)
      } else {
        return nil
      }
    }()
  }
  
  @inline(__always)
  var androidNotificationChannelName: String? {
    return { () -> String? in
      if bridge.has_value_std__optional_std__string_(self.__androidNotificationChannelName) {
        let __unwrapped = bridge.get_std__optional_std__string_(self.__androidNotificationChannelName)
        return String(__unwrapped)
      } else {
        return nil
      }
    }()
  }
  
  @inline(__always)
  var androidNotificationTitle: String? {
    return { () -> String? in
      if bridge.has_value_std__optional_std__string_(self.__androidNotificationTitle) {
        let __unwrapped = bridge.get_std__optional_std__string_(self.__androidNotificationTitle)
        return String(__unwrapped)
      } else {
        return nil
      }
    }()
  }
  
  @inline(__always)
  var androidNotificationText: String? {
    return { () -> String? in
      if bridge.has_value_std__optional_std__string_(self.__androidNotificationText) {
        let __unwrapped = bridge.get_std__optional_std__string_(self.__androidNotificationText)
        return String(__unwrapped)
      } else {
        return nil
      }
    }()
  }
}
