package api

import (
	"be.ems/src/framework/middleware"
	"be.ems/src/framework/middleware/collectlogs"
	"be.ems/src/framework/middleware/repeat"
	"be.ems/features/ue/controller"

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

// @Description Register Routes for ims_user
func VoIPAuthRegister(r *gin.RouterGroup) {

	voipAuthGroup := r.Group("/udm/voipauth")
	{
		voipAuthGroup.PUT("/resetData/:neId",
			repeat.RepeatSubmit(5),
			middleware.PreAuthorize(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.voipAuth", collectlogs.BUSINESS_TYPE_CLEAN)),
			controller.NewVoIPAuthController.ResetData,
		)
		voipAuthGroup.GET("/list",
			middleware.PreAuthorize(nil),
			controller.NewVoIPAuthController.List,
		)
		voipAuthGroup.GET("/:neId/:userName",
			middleware.PreAuthorize(nil),
			controller.NewVoIPAuthController.Info,
		)
		voipAuthGroup.POST("/:neId",
			middleware.PreAuthorize(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.voipAuth", collectlogs.BUSINESS_TYPE_INSERT)),
			controller.NewVoIPAuthController.Add,
		)
		voipAuthGroup.POST("/:neId/:num",
			middleware.PreAuthorize(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.voipAuth", collectlogs.BUSINESS_TYPE_INSERT)),
			controller.NewVoIPAuthController.Adds,
		)
		voipAuthGroup.PUT("/:neId",
			middleware.PreAuthorize(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.voipAuth", collectlogs.BUSINESS_TYPE_UPDATE)),
			controller.NewVoIPAuthController.Edit,
		)
		voipAuthGroup.DELETE("/:neId/:userName",
			middleware.PreAuthorize(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.voipAuth", collectlogs.BUSINESS_TYPE_DELETE)),
			controller.NewVoIPAuthController.Remove,
		)
		voipAuthGroup.DELETE("/:neId/:userName/:num",
			middleware.PreAuthorize(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.voipAuth", collectlogs.BUSINESS_TYPE_DELETE)),
			controller.NewVoIPAuthController.Removes,
		)
		voipAuthGroup.POST("/export",
			middleware.PreAuthorize(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.voipAuth", collectlogs.BUSINESS_TYPE_EXPORT)),
			controller.NewVoIPAuthController.Export,
		)
		voipAuthGroup.POST("/import",
			middleware.PreAuthorize(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.voipAuth", collectlogs.BUSINESS_TYPE_IMPORT)),
			controller.NewVoIPAuthController.Import,
		)
	}
}

