package admin

import (
	"github.com/gin-gonic/gin"
	v1 "server/api/v1"
	"server/middleware"
)

type DeviceRouter struct{}

func (dr *DeviceRouter) InitDeviceRouter(Router *gin.RouterGroup) {
	deviceRouter := Router.Group("device").Use(middleware.OperationRecord())
	deviceRouterWithoutRecord := Router.Group("device")
	deviceRouterApi := v1.ApiGroupApp.AdminApiGroup.DeviceApi
	{
		deviceRouter.POST("queryDeviceList", deviceRouterApi.QueryDeviceList)
		deviceRouter.POST("createDevice", deviceRouterApi.CreateDevice)
		deviceRouter.POST("deviceSwitch", deviceRouterApi.DeviceSwitch)
		deviceRouter.PUT("updateDevice", deviceRouterApi.UpdateDevice)
		deviceRouter.DELETE("deleteDevice", deviceRouterApi.DeleteDevice)
		deviceRouter.GET("queryPowerStatisticsBySn", deviceRouterApi.QueryPowerStatisticsBySn)
	}
	{
		deviceRouterWithoutRecord.GET("queryAllDevices", deviceRouterApi.QueryAllDevices)
		deviceRouterWithoutRecord.GET("generateDeviceFile", deviceRouterApi.GenerateDeviceFile)
	}
}
