// @APIVersion 1.0.0
// @Title beego Test API
// @Description beego has a very cool tools to autogenerate documents for your API
// @Contact astaxie@gmail.com
// @TermsOfServiceUrl http://beego.me/
// @License Apache 2.0
// @LicenseUrl http://www.apache.org/licenses/LICENSE-2.0.html
package routers

import (
	"github.com/astaxie/beego"
	"github.com/astaxie/beego/context"
	"k8s-console/controllers"
	"k8s-console/controllers/deployment"
	"k8s-console/controllers/ingress"
	"k8s-console/controllers/node"
	"k8s-console/controllers/pods"
	"k8s-console/controllers/pvc"
	"k8s-console/controllers/services"
	"k8s-console/controllers/storageManage"
	"k8s-console/controllers/tls"
)

func init() {
	ns := beego.NewNamespace("/k8s-console/v1",
		beego.NSNamespace("/common",
			beego.NSInclude(
				&controllers.CommonController{},
			),
		),
		beego.NSNamespace("/pod",
			beego.NSInclude(
				&pods.PodController{},
				&pods.TailPodLogController{},
			),
		),
		beego.NSNamespace("/services",
			beego.NSInclude(
				&services.ServiceController{},
			),
		),
		beego.NSNamespace("/node",
			beego.NSInclude(
				&node.NodeController{},
			),
		),
		beego.NSNamespace("/deployment",
			beego.NSInclude(
				&deployment.DeploymentController{},
			),
		),
		beego.NSNamespace("/ingress",
			beego.NSInclude(
				&ingress.IngressController{},
			),
		),
		beego.NSNamespace("/oidc",
			beego.NSInclude(
				&controllers.OidcController{},
			),
		),
		beego.NSNamespace("/sc",
			beego.NSInclude(
				&controllers.StoreController{},
			),
		),
		beego.NSNamespace("/pvc",
			beego.NSInclude(
				&pvc.PersistentVolumeClaimsController{},
			),
		),
		beego.NSNamespace("/tls",
			beego.NSInclude(
				&tls.TlsController{},
			),
		),
		beego.NSNamespace("/storageManage/pv",
			beego.NSInclude(
				&storageManage.PersistentVolumeController{},
			),
		),
		beego.NSNamespace("/statefulSet",
			beego.NSInclude(
				&controllers.StatefulSetController{},
			),
		),
	)
	beego.AddNamespace(ns)

	// 注册/terminalWebSocket
	beego.Handler("/terminalWebSocket", &pods.TerminalSockJs{}, true)

	//健康检查
	beego.Get("/health", func(ctx *context.Context) {
		ctx.Output.Body([]byte("up"))
	})

	beego.Router("/k8s-console/v1/board/showAllData/:browserId", &controllers.DashBoardController{}, "*:GetBoardAllData")

}
