package controllers

import (
	"path/filepath"

	"github.com/gofiber/fiber/v2"
)

type AdminController struct {
	spaDir string
}

func NewAdminController(spaDir string) *AdminController {
	return &AdminController{spaDir: spaDir}
}

func (ac *AdminController) Dashboard(c *fiber.Ctx) error {
	return c.SendFile(filepath.Join(ac.spaDir, "index.html"))
}

func (ac *AdminController) Fallback(c *fiber.Ctx) error {
	return c.SendFile(filepath.Join(ac.spaDir, "index.html"))
}

func (ac *AdminController) Favicon(c *fiber.Ctx) error {
	return c.SendFile(filepath.Join(ac.spaDir, "favicon.ico"))
}
