declare host LowAssets {
  [Host(module = "asset", name = "load", version = 1)]
  [Capability(name = "asset")]
  [AssetLowering(param = 0)]
  fn load(addressable: Addressable, slot: int) -> (status: int, loading_handle: int);

  [Host(module = "asset", name = "status", version = 1)]
  [Capability(name = "asset")]
  fn status(loading_handle: int) -> int;

  [Host(module = "asset", name = "commit", version = 1)]
  [Capability(name = "asset")]
  fn commit(loading_handle: int) -> int;

  [Host(module = "asset", name = "cancel", version = 1)]
  [Capability(name = "asset")]
  fn cancel(loading_handle: int) -> int;
}

declare service Assets {
  fn load(addressable: Addressable, slot: int) -> (status: int, loading_handle: int) {
    return LowAssets.load(addressable, slot);
  }

  fn status(loading_handle: int) -> int {
    return LowAssets.status(loading_handle);
  }

  fn commit(loading_handle: int) -> int {
    return LowAssets.commit(loading_handle);
  }

  fn cancel(loading_handle: int) -> int {
    return LowAssets.cancel(loading_handle);
  }
}
