package manage

import (
	_ "embed"
	"net/http"
)

//go:embed static/bulma.min.css
var bulmaCSS []byte

//go:embed static/Sortable.min.js
var sortableJS []byte

// HandleStaticBulmaCSS serves the embedded Bulma CSS file.
func HandleStaticBulmaCSS() http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		w.Header().Set("Content-Type", "text/css; charset=utf-8")
		w.Header().Set("Cache-Control", "public, max-age=31536000, immutable")
		w.Write(bulmaCSS) //nolint:errcheck
	}
}

// HandleStaticSortableJS serves the embedded SortableJS file.
func HandleStaticSortableJS() http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		w.Header().Set("Content-Type", "application/javascript; charset=utf-8")
		w.Header().Set("Cache-Control", "public, max-age=31536000, immutable")
		w.Write(sortableJS) //nolint:errcheck
	}
}
