///|
/// Returns the numeric platform tag reported by the native tray backend.
extern "C" fn current_platform_ffi() -> Int = "moonbit_tray_current_platform"

///|
/// Reports whether the native tray backend is available on the current machine.
extern "C" fn is_supported_ffi() -> Bool = "moonbit_tray_is_supported"

///|
/// Returns the last support-probe error message as UTF-8 bytes.
extern "C" fn support_error_ffi() -> Bytes = "moonbit_tray_support_error"

///|
/// Creates a native tray state and returns its opaque handle.
#borrow(identifier, icon, tooltip)
extern "C" fn create_state_ffi(
  identifier : Bytes,
  icon : Bytes,
  tooltip : Bytes,
) -> Int64 = "moonbit_tray_create"

///|
/// Returns the most recent create failure message as UTF-8 bytes.
extern "C" fn last_create_error_ffi() -> Bytes = "moonbit_tray_last_create_error"

///|
/// Destroys the native tray state associated with the given handle.
extern "C" fn destroy_state_ffi(state : Int64) -> Unit = "moonbit_tray_destroy"

///|
/// Shows the native tray icon and optionally updates its tooltip.
#borrow(tooltip)
extern "C" fn show_state_ffi(state : Int64, tooltip : Bytes) -> Bool = "moonbit_tray_show"

///|
/// Hides the native tray icon without freeing its handle.
extern "C" fn hide_state_ffi(state : Int64) -> Bool = "moonbit_tray_hide"

///|
/// Updates the tooltip text stored by the native tray state.
#borrow(tooltip)
extern "C" fn set_tooltip_ffi(state : Int64, tooltip : Bytes) -> Bool = "moonbit_tray_set_tooltip"

///|
/// Updates the icon path stored by the native tray state.
#borrow(icon)
extern "C" fn set_icon_ffi(state : Int64, icon : Bytes) -> Bool = "moonbit_tray_set_icon"

///|
/// Pumps one native event-loop step for the given tray handle.
extern "C" fn pump_state_ffi(state : Int64, blocking : Int) -> Int = "moonbit_tray_pump"

///|
/// Returns the most recent state-operation error message as UTF-8 bytes.
extern "C" fn last_state_error_ffi(state : Int64) -> Bytes = "moonbit_tray_last_error"