package api

import (
	"github.com/gin-gonic/gin"
	"gitlab.com/tensorsecurity-rd/waf-console/internal/controller"
	"gitlab.com/tensorsecurity-rd/waf-console/internal/utils"
	"gorm.io/gorm"
)

func SetWafRouter(e *gin.Engine, clusterClientManager *utils.ClusterClientManager, db *gorm.DB) {
	v1 := e.Group("v1/api")

	wafController := controller.NewWafController(clusterClientManager, db)
	v1.GET("waf/:region_code/:namespace/:gateway_name", wafController.Waf)
	v1.POST("waf", wafController.CreateWaf)
	v1.PUT("mode", wafController.UpdateMode)
	v1.POST("debug/savecatagory", wafController.SaveRuleCategoryToDB)
}
