package main import "net/http" func handleSchedulerStart(scheduler *Scheduler) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { if err := scheduler.Start(); err != nil { writeError(w, http.StatusConflict, err.Error()) return } writeJSON(w, http.StatusOK, map[string]string{"status": "started"}) } } func handleSchedulerStop(scheduler *Scheduler) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { scheduler.Stop() writeJSON(w, http.StatusOK, map[string]string{"status": "stopped"}) } } func handleSchedulerStatus(scheduler *Scheduler) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { status := scheduler.Status() writeJSON(w, http.StatusOK, status) } }