package router

import (
	"github.com/gin-gonic/gin"
	"skapp/pkg/server/controller"

	"skapp/pkg/config"
	_ "skapp/pkg/server/docs"
)

func SetupRouter(conf *config.Config, g *gin.RouterGroup) {
	setupConfigRouter(g)
	setupFileRouter(g)
	setupWolRouter(g)
	setupErrorRouter(g)

	if conf.HasDebug() && conf.Debug.Enable {
		setupSwaggerRouter(g)
	}
}

func setupConfigRouter(g *gin.RouterGroup) {
	conf := g.Group("/config")
	conf.POST("/", controller.PostConfig)
}

func setupFileRouter(g *gin.RouterGroup) {
	file := g.Group("/file")
	file.GET("/", controller.GetFile)
	file.GET("/path", controller.GetPath)
}

func setupWolRouter(g *gin.RouterGroup) {
	file := g.Group("/wol")
	file.POST("/wakeup", controller.PostWolWakeUP)
}
