package trace

import (
	"nms_nbi/src/framework/logger"
	"nms_nbi/src/framework/middleware"
	"nms_nbi/src/framework/middleware/collectlogs"
	"nms_nbi/src/modules/trace/controller"

	"github.com/gin-gonic/gin"
)

// 模块路由注册
func Setup(router *gin.Engine) {
	logger.Infof("开始加载 ====> trace 模块路由")

	// 信令抓包
	tcpdumpGroup := router.Group("/tcpdump")
	{
		tcpdumpGroup.POST("/start",
			middleware.PreAuthorize(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.tcpdump", collectlogs.BUSINESS_TYPE_OTHER)),
			controller.NewTcpdump.DumpStart,
		)
		tcpdumpGroup.POST("/stop",
			middleware.PreAuthorize(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.tcpdump", collectlogs.BUSINESS_TYPE_OTHER)),
			controller.NewTcpdump.DumpStop,
		)
		tcpdumpGroup.POST("/traceUPF",
			middleware.PreAuthorize(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.tcpdump", collectlogs.BUSINESS_TYPE_OTHER)),
			controller.NewTcpdump.TraceUPF,
		)
	}
}
