///
/// AudioSessionConfig.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 `AudioSessionConfig`, backed by a C++ struct.
 */
public typealias AudioSessionConfig = margelo.nitro.aviation.AudioSessionConfig

public extension AudioSessionConfig {
  private typealias bridge = margelo.nitro.aviation.bridge.swift

  /**
   * Create a new instance of `AudioSessionConfig`.
   */
  init(category: AudioSessionCategory?, mode: AudioSessionMode?, coexistence: AudioCoexistence?, allowBluetooth: Bool?, allowAirPlay: Bool?) {
    self.init({ () -> bridge.std__optional_AudioSessionCategory_ in
      if let __unwrappedValue = category {
        return bridge.create_std__optional_AudioSessionCategory_(__unwrappedValue)
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_AudioSessionMode_ in
      if let __unwrappedValue = mode {
        return bridge.create_std__optional_AudioSessionMode_(__unwrappedValue)
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_AudioCoexistence_ in
      if let __unwrappedValue = coexistence {
        return bridge.create_std__optional_AudioCoexistence_(__unwrappedValue)
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_bool_ in
      if let __unwrappedValue = allowBluetooth {
        return bridge.create_std__optional_bool_(__unwrappedValue)
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_bool_ in
      if let __unwrappedValue = allowAirPlay {
        return bridge.create_std__optional_bool_(__unwrappedValue)
      } else {
        return .init()
      }
    }())
  }

  @inline(__always)
  var category: AudioSessionCategory? {
    return self.__category.value
  }
  
  @inline(__always)
  var mode: AudioSessionMode? {
    return self.__mode.value
  }
  
  @inline(__always)
  var coexistence: AudioCoexistence? {
    return self.__coexistence.value
  }
  
  @inline(__always)
  var allowBluetooth: Bool? {
    return { () -> Bool? in
      if bridge.has_value_std__optional_bool_(self.__allowBluetooth) {
        let __unwrapped = bridge.get_std__optional_bool_(self.__allowBluetooth)
        return __unwrapped
      } else {
        return nil
      }
    }()
  }
  
  @inline(__always)
  var allowAirPlay: Bool? {
    return { () -> Bool? in
      if bridge.has_value_std__optional_bool_(self.__allowAirPlay) {
        let __unwrapped = bridge.get_std__optional_bool_(self.__allowAirPlay)
        return __unwrapped
      } else {
        return nil
      }
    }()
  }
}
