// Package routers @APIVersion 1.0.0
// @Title 智慧路灯LED设备及web API
// @Description 智慧路灯LED设备及web API文档
// @Contact csghh@126.com
package routers

import (
	"github.com/astaxie/beego"
	"github.com/astaxie/beego/plugins/cors"

	controllers "lc/cloud/websvr/controllers"
)

func init() {
	beego.InsertFilter("*", beego.BeforeRouter, cors.Allow(&cors.Options{
		AllowAllOrigins:  true,
		AllowMethods:     []string{"*"},
		AllowHeaders:     []string{"*"},
		ExposeHeaders:    []string{"Content-Length", "Access-Control-Allow-Origin"},
		AllowCredentials: true}))

	//cololight := beego.NewNamespace("/wp-json",
	//	beego.NSInclude(
	//		&controllers.DeviceController{},
	//	),
	//)
	//nsWeb := beego.NewNamespace("/led",
	//	beego.NSInclude(
	//		&controllers.LedController{},
	//	),
	//)
	nsIot := beego.NewNamespace("/iot",
		beego.NSInclude(
			&controllers.IotModelController{},
		),
	)
	nsEnvir := beego.NewNamespace("/environment",
		beego.NSInclude(
			&controllers.EnvironmentController{},
		),
	)
	nsSensor := beego.NewNamespace("/sensor",
		beego.NSInclude(
			&controllers.SensorController{},
		),
	)
	nsGateway := beego.NewNamespace("/gateway",
		beego.NSInclude(
			&controllers.GatewayController{},
		),
	)
	nsLamp := beego.NewNamespace("/lamp",
		beego.NSInclude(
			&controllers.LampController{},
		),
	)
	nsData := beego.NewNamespace("/data",
		beego.NSInclude(
			&controllers.DataController{},
		),
	)
	nsConcentrator := beego.NewNamespace("/concentrator",
		beego.NSInclude(
			&controllers.ConcentratorController{},
		),
	)
	nsCamera := beego.NewNamespace("/camera",
		beego.NSInclude(
			&controllers.CameraController{},
		),
	)
	//nsLededge := beego.NewNamespace("/lededge",
	//	beego.NSInclude(
	//		&controllers.LedEdgeController{},
	//	),
	//)
	nsIts := beego.NewNamespace("/its",
		beego.NSInclude(
			&controllers.ItsController{},
		),
	)
	nsAs := beego.NewNamespace("/as",
		beego.NSInclude(
			&controllers.AlarmStrategyController{},
		),
	)
	nsRadar := beego.NewNamespace("/radar",
		beego.NSInclude(
			&controllers.RadarController{},
		),
	)

	nsCltled := beego.NewNamespace("/cltled",
		beego.NSInclude(
			&controllers.CltledController{},
		),
	)

	beego.AddNamespace(nsIot, nsEnvir, nsSensor,
		nsGateway, nsLamp, nsData, nsConcentrator,
		nsCamera, nsIts, nsAs, nsRadar, nsCltled)
}
