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

public extension RecorderSettings {
  private typealias bridge = margelo.nitro.camera.bridge.swift

  /**
   * Create a new instance of `RecorderSettings`.
   */
  init(location: (any HybridLocationSpec)?, filePath: String?, maxDuration: Double?, maxFileSize: Double?) {
    self.init({ () -> bridge.std__optional_std__shared_ptr_HybridLocationSpec__ in
      if let __unwrappedValue = location {
        return bridge.create_std__optional_std__shared_ptr_HybridLocationSpec__({ () -> bridge.std__shared_ptr_HybridLocationSpec_ in
          let __cxxWrapped = __unwrappedValue.getCxxWrapper()
          return __cxxWrapped.getCxxPart()
        }())
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_std__string_ in
      if let __unwrappedValue = filePath {
        return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_double_ in
      if let __unwrappedValue = maxDuration {
        return bridge.create_std__optional_double_(__unwrappedValue)
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_double_ in
      if let __unwrappedValue = maxFileSize {
        return bridge.create_std__optional_double_(__unwrappedValue)
      } else {
        return .init()
      }
    }())
  }

  @inline(__always)
  var location: (any HybridLocationSpec)? {
    return { () -> (any HybridLocationSpec)? in
      if bridge.has_value_std__optional_std__shared_ptr_HybridLocationSpec__(self.__location) {
        let __unwrapped = bridge.get_std__optional_std__shared_ptr_HybridLocationSpec__(self.__location)
        return { () -> any HybridLocationSpec in
          let __unsafePointer = bridge.get_std__shared_ptr_HybridLocationSpec_(__unwrapped)
          let __instance = HybridLocationSpec_cxx.fromUnsafe(__unsafePointer)
          return __instance.getHybridLocationSpec()
        }()
      } else {
        return nil
      }
    }()
  }
  
  @inline(__always)
  var filePath: String? {
    return { () -> String? in
      if bridge.has_value_std__optional_std__string_(self.__filePath) {
        let __unwrapped = bridge.get_std__optional_std__string_(self.__filePath)
        return String(__unwrapped)
      } else {
        return nil
      }
    }()
  }
  
  @inline(__always)
  var maxDuration: Double? {
    return { () -> Double? in
      if bridge.has_value_std__optional_double_(self.__maxDuration) {
        let __unwrapped = bridge.get_std__optional_double_(self.__maxDuration)
        return __unwrapped
      } else {
        return nil
      }
    }()
  }
  
  @inline(__always)
  var maxFileSize: Double? {
    return { () -> Double? in
      if bridge.has_value_std__optional_double_(self.__maxFileSize) {
        let __unwrapped = bridge.get_std__optional_double_(self.__maxFileSize)
        return __unwrapped
      } else {
        return nil
      }
    }()
  }
}
