package api

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

func SetWafApiServerRouter(e *gin.Engine, clusterClientManager *utils.ClusterClientManager, db *gorm.DB, gatewayUrl string, elasticClient *elastic.Client) {
	wafController := controller.NewWafController(clusterClientManager, db, gatewayUrl, elasticClient, nil)
	v2 := e.Group("api/v2/waf")
	v2.GET("attack/log/list", wafController.ListAttackLogs)
	v2.GET("attack/log/details", wafController.GetAttackLogDetails)
	v2.GET("attack/log/rspPkg", wafController.GetAttackLogRsp)
	v2.GET("attack/log/count", wafController.CountAttackLogs)
}
