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 UDMIMSUserRegister(r *gin.RouterGroup) {

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

