package oam

import (
	"github.com/gin-gonic/gin"
	"github.com/tsmask/go-oam"

	"be.ems/src/framework/logger"
	"be.ems/src/modules/oam/controller"
	"be.ems/src/modules/oam/service"
)

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

	// 网管接收端收告警
	oam.AlarmReceiveRoute(router, service.NewAlarm.Resolve)
	// 网管接收端收终端接入基站
	oam.UENBReceiveRoute(router, service.NewUENB.Resolve)
	// 网管接收端收基站状态
	oam.NBStateReceiveRoute(router, service.NewNBState.Resolve)
	// 网管接收端收话单
	oam.CDRReceiveRoute(router, service.NewCDR.Resolve)
	// 网管接收端收KPI
	oam.KPIReceiveRoute(router, service.NewKPI.Resolve)

	// APIRest 北向定义
	aprRest := controller.NewAPIRest
	aprRestGroup := router.Group("/api/rest")
	{
		aprRestGroup.GET("/faultManagement/v1/elementType/:elementTypeValue/objectType/alarms", aprRest.ResolveAlarmHistory)
		aprRestGroup.POST("/faultManagement/v1/elementType/:elementTypeValue/objectType/alarms", aprRest.ResolveAlarm)
		aprRestGroup.POST("/cdrManagement/v1/elementType/:elementTypeValue/objectType/cdrEvent", aprRest.ResolveCDR)
		aprRestGroup.POST("/performanceManagement/v1/elementType/:elementTypeValue/objectType/kpiReport/:index", aprRest.ResolveKPI)
		aprRestGroup.POST("/ueManagement/v1/elementType/:elementTypeValue/objectType/nbState", aprRest.ResolveNBState)
		aprRestGroup.POST("/ueManagement/v1/elementType/:elementTypeValue/objectType/cbsState", aprRest.ResolveCBSState)
		aprRestGroup.POST("/logManagement/v1/elementType/:elementTypeValue/objectType/ueEvent", aprRest.ResolveUENB)
		router.POST("/upload-ue/v1/:eventType", aprRest.ResolveUENBByAMF) // AMF特殊上报
		aprRestGroup.GET("/systemManagement/v1/elementType/:elementTypeValue/objectType/systemState", aprRest.QuerySystemState)
		aprRestGroup.PUT("/systemManagement/v1/elementType/:elementTypeValue/objectType/config/omcNeConfig", aprRest.NeConfigOMC)
	}

}
