package main

func (w *Webapp) initApi() {

	stream := NewServer()

	w.Stream = stream

	http_api := w.Engine.Group("/api")
	http_api.GET("/priority", w.GetPriority)
	http_api.POST("/priority", w.SetPriority)

	// SSE
	http_api.GET("/sse", HeadersMiddleware(), stream.serveHTTP(), stream.retvalSSE())

	http_api.POST("/startheat", w.StartHeatTimer)
	http_api.GET("/stopheat", w.StopHeatTimer)
	http_api.POST("/saveheat", w.SaveHeat)
	http_api.POST("/deleteheat", w.DeleteHeat)
	http_api.GET("/loadheats", w.LoadHeats)
	http_api.GET("/runningheat", w.LoadRunning)

	// // Surfers
	// http_api.GET("/surfers", w.GetSurfers)
	// http_api.POST("/updatesurfer", w.UpdateSurfer)
	// http_api.POST("/deletesurfer", w.DeleteSurfer)

	// // Users
	// http_api.GET("/users", w.GetUsers)
	// http_api.POST("/updateuser", w.UpdateUser)
	// http_api.POST("/deleteuser", w.DeleteUser)
}
