package ws

import (
	"be.ems/src/framework/logger"
	"be.ems/src/framework/middleware"
	"be.ems/src/framework/middleware/collectlogs"
	"be.ems/src/modules/ws/controller"

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

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

	// WebSocket 协议
	wsGroup := router.Group("/ws")
	{
		wsGroup.GET("",
			middleware.PreAuthorize(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.ws", collectlogs.BUSINESS_TYPE_OTHER)),
			controller.NewWSController.WS,
		)
		wsGroup.GET("/ssh",
			middleware.PreAuthorize(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.ws", collectlogs.BUSINESS_TYPE_OTHER)),
			controller.NewWSController.SSH,
		)
		wsGroup.GET("/telnet",
			middleware.PreAuthorize(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.ws", collectlogs.BUSINESS_TYPE_OTHER)),
			controller.NewWSController.Telnet,
		)
		wsGroup.GET("/test",
			middleware.PreAuthorize(nil),
			controller.NewWSController.Test,
		)
	}
}
