/**
 * Auto-generated TypeScript bindings for Tauri commands
 * Generated by tauri-typegen v0.5.0
 * Generated at: 2026-04-03T09:09:31.629251800+00:00
 * Generator: none
 *
 * Do not edit manually - regenerate using: cargo tauri-typegen generate
 */

/**
 * Event Listeners
 * Type-safe event listener helpers for Tauri events
 */
import { listen, type UnlistenFn } from "@tauri-apps/api/event";
import * as types from "./types";

/**
 * Listen for 'status-change' events
 * @param handler - Callback function to handle the event
 * @returns Promise that resolves to an unlisten function
 */
export async function onStatusChange(handler: (payload: string) => void): Promise<UnlistenFn> {
  return listen<string>("status-change", (event) => {
    handler(event.payload);
  });
}

/**
 * Listen for 'ws-state' events
 * @param handler - Callback function to handle the event
 * @returns Promise that resolves to an unlisten function
 */
export async function onWsState(handler: (payload: string) => void): Promise<UnlistenFn> {
  return listen<string>("ws-state", (event) => {
    handler(event.payload);
  });
}

/**
 * Listen for 'cert-tofu' events
 * @param handler - Callback function to handle the event
 * @returns Promise that resolves to an unlisten function
 */
export async function onCertTofu(handler: (payload: types.Value) => void): Promise<UnlistenFn> {
  return listen<types.Value>("cert-tofu", (event) => {
    handler(event.payload);
  });
}
