package api

import (
	"github.com/gin-gonic/gin"
	"gitlab.com/tensorsecurity-rd/waf-console/cmd/api-server/config"
	"gitlab.com/tensorsecurity-rd/waf-console/internal/controller"
)

func SetWafProxyRouter(e *gin.Engine, regionConfigs []config.RegionConfig) {
	v2 := e.Group("api/v2/containerSec/waf")

	regionUrlMap := make(map[string]string)
	for _, regionConfig := range regionConfigs {
		regionUrlMap[regionConfig.RegionCode] = regionConfig.ApiServer
	}
	wafLogController := controller.NewWafLogController(regionUrlMap)

	v2.GET("/waf/log", wafLogController.WafLogProxy)
}
