package ne_data

import (
	"be.ems/src/framework/logger"
	"be.ems/src/framework/middleware"
	"be.ems/src/framework/middleware/collectlogs"
	"be.ems/src/framework/middleware/repeat"
	"be.ems/src/modules/ne_data/controller"
	"be.ems/src/modules/ne_data/service"

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

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

	// 启动时需要的初始参数
	InitLoad()

	neDataGroup := router.Group("/neData")

	// 性能统计信息
	kpiGroup := neDataGroup.Group("/kpi")
	{
		kpiGroup.GET("/title",
			middleware.AuthorizeUser(nil),
			controller.NewKPI.KPITitle,
		)
		kpiGroup.GET("/title/list",
			middleware.AuthorizeUser(nil),
			controller.NewKPI.ListTitle,
		)
		kpiGroup.POST("/title",
			middleware.AuthorizeUser(nil),
			controller.NewKPI.AddTitle,
		)
		kpiGroup.PUT("/title",
			middleware.AuthorizeUser(nil),
			controller.NewKPI.EditTitle,
		)
		kpiGroup.DELETE("/title",
			middleware.AuthorizeUser(nil),
			controller.NewKPI.RemoveTitle,
		)
		kpiGroup.GET("/data",
			middleware.AuthorizeUser(nil),
			controller.NewKPI.KPIData,
		)
	}

	// 性能自定义统计信息
	kpicGroup := neDataGroup.Group("/kpic")
	{
		kpicGroup.GET("/data",
			middleware.AuthorizeUser(nil),
			controller.NewKPIC.KPIData,
		)
		kpicGroup.GET("/title/list",
			middleware.AuthorizeUser(nil),
			controller.NewKPIC.ListTitle,
		)
		kpicGroup.POST("/title",
			middleware.AuthorizeUser(nil),
			controller.NewKPIC.AddTitle,
		)
		kpicGroup.PUT("/title",
			middleware.AuthorizeUser(nil),
			controller.NewKPIC.EditTitle,
		)
		kpicGroup.DELETE("/title",
			middleware.AuthorizeUser(nil),
			controller.NewKPIC.RemoveTitle,
		)
	}

	// 告警数据信息
	alarmGroup := neDataGroup.Group("/alarm")
	{
		alarmGroup.GET("/list",
			middleware.AuthorizeUser(nil),
			controller.NewAlarm.List,
		)
		alarmGroup.DELETE("/:id",
			middleware.AuthorizeUser(nil),
			controller.NewAlarm.Remove,
		)
		alarmGroup.PUT("/clear",
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.alarm", collectlogs.BUSINESS_TYPE_UPDATE)),
			controller.NewAlarm.Clear,
		)
		alarmGroup.PUT("/ack",
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.alarm", collectlogs.BUSINESS_TYPE_UPDATE)),
			controller.NewAlarm.Ack,
		)
		alarmGroup.GET("/export",
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.alarm", collectlogs.BUSINESS_TYPE_EXPORT)),
			controller.NewAlarm.Export,
		)
		alarmGroup.GET("/count/type",
			middleware.AuthorizeUser(nil),
			controller.NewAlarm.CountType,
		)
		alarmGroup.GET("/count/severity",
			middleware.AuthorizeUser(nil),
			controller.NewAlarm.CountSeverity,
		)
		alarmGroup.GET("/count/ne",
			middleware.AuthorizeUser(nil),
			controller.NewAlarm.CountNe,
		)
	}

	// 告警日志数据信息
	alarmLogGroup := neDataGroup.Group("/alarm/log")
	{
		alarmLogGroup.GET("/list",
			middleware.AuthorizeUser(nil),
			controller.NewAlarmLog.List,
		)

		alarmLogGroup.GET("/event",
			middleware.AuthorizeUser(nil),
			controller.NewAlarmLog.Event,
		)
	}

	// 告警转发数据信息
	alarmForwardGroup := neDataGroup.Group("/alarm/forward")
	{
		alarmForwardGroup.GET("/log/list",
			middleware.AuthorizeUser(nil),
			controller.NewAlarmForward.List,
		)
	}

	// 网元状态记录信息
	neStateGroup := neDataGroup.Group("/ne-state")
	{
		neStateGroup.GET("/list",
			middleware.AuthorizeUser(nil),
			controller.NewNEState.List,
		)
	}

	// 基站状态历史记录信息 含AMF/MME
	nbStateGroup := neDataGroup.Group("/nb-state")
	{
		nbStateGroup.GET("/list",
			middleware.AuthorizeUser(nil),
			controller.NewNBState.List,
		)
		nbStateGroup.GET("/export",
			middleware.AuthorizeUser(nil),
			controller.NewNBState.Export,
		)
	}

	// 网元IMS
	imsGroup := neDataGroup.Group("/ims")
	{
		imsGroup.GET("/cdr/list",
			middleware.AuthorizeUser(nil),
			controller.NewIMS.CDRList,
		)
		imsGroup.DELETE("/cdr/:id",
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.imsCDR", collectlogs.BUSINESS_TYPE_DELETE)),
			controller.NewIMS.CDRRemove,
		)
		imsGroup.GET("/cdr/export",
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.imsCDR", collectlogs.BUSINESS_TYPE_EXPORT)),
			controller.NewIMS.CDRExport,
		)
		imsGroup.GET("/session/num",
			middleware.AuthorizeUser(nil),
			controller.NewIMS.UeSessionNum,
		)
		imsGroup.GET("/session/list",
			middleware.AuthorizeUser(nil),
			controller.NewIMS.UeSessionList,
		)
		imsGroup.GET("/kpi/busy-hour",
			middleware.AuthorizeUser(nil),
			controller.NewIMS.KPIBusyHour,
		)
		imsGroup.GET("/kpi/busy-week",
			middleware.AuthorizeUser(nil),
			controller.NewIMS.KPIBusyWeek,
		)
		imsGroup.GET("/cdr/mos-hour",
			middleware.AuthorizeUser(nil),
			controller.NewIMS.CDRMOSHour,
		)
		imsGroup.GET("/cdr/cct-hour",
			middleware.AuthorizeUser(nil),
			controller.NewIMS.CDRCCTHour,
		)
	}

	// 网元SMSC
	smscGroup := neDataGroup.Group("/smsc")
	{
		smscGroup.GET("/cdr/list",
			middleware.AuthorizeUser(nil),
			controller.NewSMSC.CDRList,
		)
		smscGroup.DELETE("/cdr/:id",
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.smscCDR", collectlogs.BUSINESS_TYPE_DELETE)),
			controller.NewSMSC.CDRRemove,
		)
		smscGroup.GET("/cdr/export",
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.smscCDR", collectlogs.BUSINESS_TYPE_EXPORT)),
			controller.NewSMSC.CDRExport,
		)
	}

	// 网元SMF
	smfGroup := neDataGroup.Group("/smf")
	{
		smfGroup.GET("/cdr/list",
			middleware.AuthorizeUser(nil),
			controller.NewSMF.CDRList,
		)
		smfGroup.DELETE("/cdr/:id",
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.smfCDR", collectlogs.BUSINESS_TYPE_DELETE)),
			controller.NewSMF.CDRRemove,
		)
		smfGroup.GET("/cdr/export",
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.smfCDR", collectlogs.BUSINESS_TYPE_EXPORT)),
			controller.NewSMF.CDRExport,
		)
		smfGroup.GET("/sub/num",
			middleware.AuthorizeUser(nil),
			controller.NewSMF.SubUserNum,
		)
		smfGroup.GET("/sub/list",
			middleware.AuthorizeUser(nil),
			controller.NewSMF.SubUserList,
		)
	}

	// 网元AMF
	amfGroup := neDataGroup.Group("/amf")
	{
		amfGroup.GET("/ue/list",
			middleware.AuthorizeUser(nil),
			controller.NewAMF.UEList,
		)
		amfGroup.DELETE("/ue/:id",
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.amfUE", collectlogs.BUSINESS_TYPE_DELETE)),
			controller.NewAMF.UERemove,
		)
		amfGroup.GET("/ue/export",
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.amfUE", collectlogs.BUSINESS_TYPE_EXPORT)),
			controller.NewAMF.UEExport,
		)
		amfGroup.GET("/nb/list",
			middleware.AuthorizeUser(nil),
			controller.NewAMF.NbInfoList,
		)
		amfGroup.GET("/nb/list-cfg",
			middleware.AuthorizeUser(nil),
			controller.NewAMF.NbStateList,
		)
	}

	// 网元UPF
	upfGroup := neDataGroup.Group("/upf")
	{
		upfGroup.GET("/flow-total",
			middleware.AuthorizeUser(nil),
			controller.NewUPF.FlowTotal,
		)
	}

	// 网元N3IWF
	n3iwfGroup := neDataGroup.Group("/n3iwf")
	{
		n3iwfGroup.GET("/sub/list",
			middleware.AuthorizeUser(nil),
			controller.NewN3IWF.SubUserList,
		)
	}

	// 网元N3IWF
	nssf := controller.NewNSSF
	nssfGroup := neDataGroup.Group("/nssf")
	{
		nssfGroup.GET("/sub/list",
			middleware.AuthorizeUser(nil),
			nssf.SubUserList,
		)
		nssfGroup.GET("/amf/list",
			middleware.AuthorizeUser(nil),
			nssf.AvailableList,
		)
	}

	// 备份数据
	backupGroup := neDataGroup.Group("/backup")
	{
		backupGroup.GET("/ftp",
			middleware.AuthorizeUser(nil),
			controller.NewBackup.FTPInfo,
		)
		backupGroup.PUT("/ftp",
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.backup", collectlogs.BUSINESS_TYPE_OTHER)),
			controller.NewBackup.FTPUpdate,
		)
		backupGroup.POST("/ftp",
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.backup", collectlogs.BUSINESS_TYPE_OTHER)),
			controller.NewBackup.FTPPush,
		)
		backupGroup.POST("/import-omc",
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.backup", collectlogs.BUSINESS_TYPE_IMPORT)),
			controller.NewBackup.ImportOMC,
		)
		backupGroup.POST("/export-omc",
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.backup", collectlogs.BUSINESS_TYPE_EXPORT)),
			controller.NewBackup.ExportOMC,
		)
	}

	// 网元UDM 鉴权用户信息
	udmAuthGroup := neDataGroup.Group("/udm/auth")
	{
		udmAuthGroup.PUT("/resetData/:neId",
			repeat.RepeatSubmit(5),
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmAuth", collectlogs.BUSINESS_TYPE_CLEAN)),
			controller.NewUDMAuth.ResetData,
		)
		udmAuthGroup.GET("/list",
			middleware.AuthorizeUser(nil),
			controller.NewUDMAuth.List,
		)
		udmAuthGroup.GET("/:neId/:imsi",
			middleware.AuthorizeUser(nil),
			controller.NewUDMAuth.Info,
		)
		udmAuthGroup.POST("/:neId",
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmAuth", collectlogs.BUSINESS_TYPE_INSERT)),
			controller.NewUDMAuth.Add,
		)
		udmAuthGroup.POST("/:neId/:num",
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmAuth", collectlogs.BUSINESS_TYPE_INSERT)),
			controller.NewUDMAuth.Adds,
		)
		udmAuthGroup.PUT("/:neId",
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmAuth", collectlogs.BUSINESS_TYPE_UPDATE)),
			controller.NewUDMAuth.Edit,
		)
		udmAuthGroup.DELETE("/:neId/:imsi",
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmAuth", collectlogs.BUSINESS_TYPE_DELETE)),
			controller.NewUDMAuth.Remove,
		)
		udmAuthGroup.DELETE("/:neId/:imsi/:num",
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmAuth", collectlogs.BUSINESS_TYPE_DELETE)),
			controller.NewUDMAuth.Removes,
		)
		udmAuthGroup.GET("/export",
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmAuth", collectlogs.BUSINESS_TYPE_EXPORT)),
			controller.NewUDMAuth.Export,
		)
		udmAuthGroup.POST("/import",
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmAuth", collectlogs.BUSINESS_TYPE_IMPORT)),
			controller.NewUDMAuth.Import,
		)
		udmAuthGroup.GET("/export-dec",
			middleware.AuthorizeUser(map[string][]string{"hasPerms": {"neData:udm-auth:export-dec"}}),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmAuth", collectlogs.BUSINESS_TYPE_EXPORT)),
			controller.NewUDMAuth.ExportDec,
		)
	}

	// 网元UDM 签约用户信息
	udmSubGroup := neDataGroup.Group("/udm/sub")
	{
		udmSubGroup.PUT("/resetData/:neId",
			repeat.RepeatSubmit(5),
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmSub", collectlogs.BUSINESS_TYPE_CLEAN)),
			controller.NewUDMSub.ResetData,
		)
		udmSubGroup.GET("/list",
			middleware.AuthorizeUser(nil),
			controller.NewUDMSub.List,
		)
		udmSubGroup.GET("/:neId/:imsi",
			middleware.AuthorizeUser(nil),
			controller.NewUDMSub.Info,
		)
		udmSubGroup.POST("/:neId",
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmSub", collectlogs.BUSINESS_TYPE_INSERT)),
			controller.NewUDMSub.Add,
		)
		udmSubGroup.POST("/:neId/:num",
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmSub", collectlogs.BUSINESS_TYPE_INSERT)),
			controller.NewUDMSub.Adds,
		)
		udmSubGroup.PUT("/:neId",
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmSub", collectlogs.BUSINESS_TYPE_UPDATE)),
			controller.NewUDMSub.Edit,
		)
		udmSubGroup.DELETE("/:neId/:imsi",
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmSub", collectlogs.BUSINESS_TYPE_DELETE)),
			controller.NewUDMSub.Remove,
		)
		udmSubGroup.DELETE("/:neId/:imsi/:num",
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmSub", collectlogs.BUSINESS_TYPE_DELETE)),
			controller.NewUDMSub.Removes,
		)
		udmSubGroup.GET("/export",
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmSub", collectlogs.BUSINESS_TYPE_EXPORT)),
			controller.NewUDMSub.Export,
		)
		udmSubGroup.POST("/import",
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmSub", collectlogs.BUSINESS_TYPE_IMPORT)),
			controller.NewUDMSub.Import,
		)
	}

	// 网元UDM VOIP用户信息
	udmVOIPGroup := neDataGroup.Group("/udm/voip")
	{
		udmVOIPGroup.PUT("/resetData/:neId",
			repeat.RepeatSubmit(5),
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmVOIP", collectlogs.BUSINESS_TYPE_CLEAN)),
			controller.NewUDMVOIP.ResetData,
		)
		udmVOIPGroup.GET("/list",
			middleware.AuthorizeUser(nil),
			controller.NewUDMVOIP.List,
		)
		udmVOIPGroup.GET("/:neId/:username",
			middleware.AuthorizeUser(nil),
			controller.NewUDMVOIP.Info,
		)
		udmVOIPGroup.POST("/:neId",
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmVOIP", collectlogs.BUSINESS_TYPE_INSERT)),
			controller.NewUDMVOIP.Add,
		)
		udmVOIPGroup.POST("/:neId/:num",
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmVOIP", collectlogs.BUSINESS_TYPE_INSERT)),
			controller.NewUDMVOIP.Adds,
		)
		udmVOIPGroup.DELETE("/:neId/:username",
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmVOIP", collectlogs.BUSINESS_TYPE_DELETE)),
			controller.NewUDMVOIP.Remove,
		)
		udmVOIPGroup.DELETE("/:neId/:username/:num",
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmVOIP", collectlogs.BUSINESS_TYPE_DELETE)),
			controller.NewUDMVOIP.Removes,
		)
		udmVOIPGroup.GET("/export",
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmVOIP", collectlogs.BUSINESS_TYPE_EXPORT)),
			controller.NewUDMVOIP.Export,
		)
		udmVOIPGroup.POST("/import",
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmVOIP", collectlogs.BUSINESS_TYPE_IMPORT)),
			controller.NewUDMVOIP.Import,
		)
	}

	// 网元UDM VolteIMS用户信息
	udmVolteIMSGroup := neDataGroup.Group("/udm/volte-ims")
	{
		udmVolteIMSGroup.PUT("/resetData/:neId",
			repeat.RepeatSubmit(5),
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmVolteIMS", collectlogs.BUSINESS_TYPE_CLEAN)),
			controller.NewUDMVolteIMS.ResetData,
		)
		udmVolteIMSGroup.GET("/list",
			middleware.AuthorizeUser(nil),
			controller.NewUDMVolteIMS.List,
		)
		udmVolteIMSGroup.GET("/:neId/:imsi",
			middleware.AuthorizeUser(nil),
			controller.NewUDMVolteIMS.Info,
		)
		udmVolteIMSGroup.POST("/:neId",
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmVolteIMS", collectlogs.BUSINESS_TYPE_INSERT)),
			controller.NewUDMVolteIMS.Add,
		)
		udmVolteIMSGroup.POST("/:neId/:num",
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmVolteIMS", collectlogs.BUSINESS_TYPE_INSERT)),
			controller.NewUDMVolteIMS.Adds,
		)
		udmVolteIMSGroup.DELETE("/:neId/:imsi",
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmVolteIMS", collectlogs.BUSINESS_TYPE_DELETE)),
			controller.NewUDMVolteIMS.Remove,
		)
		udmVolteIMSGroup.DELETE("/:neId/:imsi/:num",
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmVolteIMS", collectlogs.BUSINESS_TYPE_DELETE)),
			controller.NewUDMVolteIMS.Removes,
		)
		udmVolteIMSGroup.GET("/export",
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmVolteIMS", collectlogs.BUSINESS_TYPE_EXPORT)),
			controller.NewUDMVolteIMS.Export,
		)
		udmVolteIMSGroup.POST("/import",
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.udmVolteIMS", collectlogs.BUSINESS_TYPE_IMPORT)),
			controller.NewUDMVolteIMS.Import,
		)
	}

	// 网元MME
	mmeGroup := neDataGroup.Group("/mme")
	{
		mmeGroup.GET("/ue/list",
			middleware.AuthorizeUser(nil),
			controller.NewMME.UEList,
		)
		mmeGroup.DELETE("/ue/:id",
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.mmeUE", collectlogs.BUSINESS_TYPE_DELETE)),
			controller.NewMME.UERemove,
		)
		mmeGroup.GET("/ue/export",
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.mmeUE", collectlogs.BUSINESS_TYPE_EXPORT)),
			controller.NewMME.UEExport,
		)
		mmeGroup.GET("/nb/list",
			middleware.AuthorizeUser(nil),
			controller.NewMME.NbInfoList,
		)
		mmeGroup.GET("/nb/list-cfg",
			middleware.AuthorizeUser(nil),
			controller.NewMME.NbStateList,
		)
	}

	// 网元SGWC
	sgwcGroup := neDataGroup.Group("/sgwc")
	{
		sgwcGroup.GET("/cdr/list",
			middleware.AuthorizeUser(nil),
			controller.NewSGWC.CDRList,
		)
		sgwcGroup.DELETE("/cdr/:id",
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.sgwcCDR", collectlogs.BUSINESS_TYPE_DELETE)),
			controller.NewSGWC.CDRRemove,
		)
		sgwcGroup.POST("/cdr/export",
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.sgwcCDR", collectlogs.BUSINESS_TYPE_EXPORT)),
			controller.NewSGWC.CDRExport,
		)
	}

	// 网元PCF
	pcfGroup := neDataGroup.Group("/pcf")
	{
		pcfGroup.GET("/rule/list",
			middleware.AuthorizeUser(nil),
			controller.NewPCF.RuleInfoList,
		)
		pcfGroup.POST("/rule",
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.pcfRule", collectlogs.BUSINESS_TYPE_IMPORT)),
			controller.NewPCF.RuleInfoAdd,
		)
		pcfGroup.PUT("/rule",
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.pcfRule", collectlogs.BUSINESS_TYPE_UPDATE)),
			controller.NewPCF.RuleInfoEdit,
		)
		pcfGroup.DELETE("/rule",
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.pcfRule", collectlogs.BUSINESS_TYPE_DELETE)),
			controller.NewPCF.RuleInfoRemove,
		)
		pcfGroup.GET("/rule/export",
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.pcfRule", collectlogs.BUSINESS_TYPE_EXPORT)),
			controller.NewPCF.RuleInfoExport,
		)
		pcfGroup.PUT("/rule/import",
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.pcfRule", collectlogs.BUSINESS_TYPE_IMPORT)),
			controller.NewPCF.RuleInfoImport,
		)
	}

	// 网元CBC
	cbcGroup := neDataGroup.Group("/cbc")
	{
		cbcGroup.GET("/message/list",
			middleware.AuthorizeUser(nil),
			controller.NewCBC.List,
		)
		cbcGroup.GET("/message/:id",
			middleware.AuthorizeUser(nil),
			controller.NewCBC.ListById,
		)
		cbcGroup.POST("/message",
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.cbcMessage", collectlogs.BUSINESS_TYPE_IMPORT)),
			controller.NewCBC.Insert,
		)
		cbcGroup.PUT("/message/:id",
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.cbcMessage", collectlogs.BUSINESS_TYPE_UPDATE)),
			controller.NewCBC.Update,
		)
		cbcGroup.PUT("/message/:id/:status",
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.cbcMessage", collectlogs.BUSINESS_TYPE_UPDATE)),
			controller.NewCBC.UpdateStatus,
		)
		cbcGroup.DELETE("/message/:id",
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.cbcMessage", collectlogs.BUSINESS_TYPE_DELETE)),
			controller.NewCBC.Delete,
		)
		cbcGroup.GET("/message/export",
			middleware.AuthorizeUser(nil),
			collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.cbcMessage", collectlogs.BUSINESS_TYPE_EXPORT)),
			controller.NewCBC.Export,
		)
	}
}

// InitLoad 初始参数
func InitLoad() {
	// 启动时，加载UPF上下行流量
	go service.NewKpiReport.UPFTodayFlowLoad(30)
}
