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

import NitroModules

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

public extension BandwidthData {
  private typealias bridge = margelo.nitro.video.bridge.swift

  /**
   * Create a new instance of `BandwidthData`.
   */
  init(bitrate: Double, width: Double?, height: Double?) {
    self.init(bitrate, { () -> bridge.std__optional_double_ in
      if let __unwrappedValue = width {
        return bridge.create_std__optional_double_(__unwrappedValue)
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_double_ in
      if let __unwrappedValue = height {
        return bridge.create_std__optional_double_(__unwrappedValue)
      } else {
        return .init()
      }
    }())
  }

  var bitrate: Double {
    @inline(__always)
    get {
      return self.__bitrate
    }
    @inline(__always)
    set {
      self.__bitrate = newValue
    }
  }
  
  var width: Double? {
    @inline(__always)
    get {
      return self.__width.value
    }
    @inline(__always)
    set {
      self.__width = { () -> bridge.std__optional_double_ in
        if let __unwrappedValue = newValue {
          return bridge.create_std__optional_double_(__unwrappedValue)
        } else {
          return .init()
        }
      }()
    }
  }
  
  var height: Double? {
    @inline(__always)
    get {
      return self.__height.value
    }
    @inline(__always)
    set {
      self.__height = { () -> bridge.std__optional_double_ in
        if let __unwrappedValue = newValue {
          return bridge.create_std__optional_double_(__unwrappedValue)
        } else {
          return .init()
        }
      }()
    }
  }
}
