// Code generated by ndpgen. DO NOT EDIT.//// This file contains export wrappers for the SchedulerCallback capability.// It is intended for use in Navidrome plugins built with TinyGo.////go:build wasip1package schedulerimport ("github.com/navidrome/navidrome/plugins/pdk/go/pdk")// SchedulerCallbackRequest is the request provided when a scheduled task fires.type SchedulerCallbackRequest struct {// ScheduleID is the unique identifier for this scheduled task.// This is either the ID provided when scheduling, or an auto-generated UUID if none was specified.ScheduleID string `json:"scheduleId"`// Payload is the payload data that was provided when the task was scheduled.// Can be used to pass context or parameters to the callback handler.Payload string `json:"payload"`// IsRecurring is true if this is a recurring schedule (created via ScheduleRecurring),// false if it's a one-time schedule (created via ScheduleOneTime).IsRecurring bool `json:"isRecurring"`}// Scheduler is the marker interface for scheduler plugins.// Implement one or more of the provider interfaces below.// SchedulerCallback provides scheduled task handling.// This capability allows plugins to receive callbacks when their scheduled tasks execute.// Plugins that use the scheduler host service must implement this capability// to handle task execution.type Scheduler interface{}// CallbackProvider provides the OnCallback function.type CallbackProvider interface {OnCallback(SchedulerCallbackRequest) error} // Internal implementation holdersvar (callbackImpl func(SchedulerCallbackRequest) error)// Register registers a scheduler implementation.// The implementation is checked for optional provider interfaces.func Register(impl Scheduler) {if p, ok := impl.(CallbackProvider); ok {callbackImpl = p.OnCallback}}// NotImplementedCode is the standard return code for unimplemented functions.// The host recognizes this and skips the plugin gracefully.const NotImplementedCode int32 = -2//go:wasmexport nd_scheduler_callbackfunc _NdSchedulerCallback() int32 {if callbackImpl == nil {// Return standard code - host will skip this plugin gracefullyreturn NotImplementedCode}var input SchedulerCallbackRequestif err := pdk.InputJSON(&input); err != nil {pdk.SetError(err)return -1}if err := callbackImpl(input); err != nil {pdk.SetError(err)return -1}return 0}