package main

import (
	chi "github.com/go-chi/chi/v5"

	"xtablo-backend/internal/spahandler"
)

func registerProdRoutes(mux *chi.Mux) {
	spaHandler := spahandler.NewHandler()

	// Handle requests for Vite-managed assets.
	mux.Get("/assets/*", spaHandler.GetAssets())

	// Handle index.html request
	mux.Get("/*", spaHandler.GetSpa())
}

func registerDevRoutes(mux *chi.Mux) {
	spaHandler := spahandler.NewHandler()

	// Handle index.html request
	mux.Get("/*", spaHandler.GetDevSpa())
}

var indexTmpl = `<!doctype html>
<html lang="en" class="h-full scroll-smooth">
  <head>
    <meta charset="UTF-8" />
		{{ .Vite.Tags }}
 </head>
  <body class="w-100">
    <div id="app"></div>
  </body>
</html>
`
