package main

import (
	"net/http"

	"ciyon/web/admin"
	"ciyon/web/admin/ap"
	"ciyon/web/admin/autotask"
	"ciyon/web/admin/datasse"
	"ciyon/web/admin/demo"
	"ciyon/web/admin/demo/dyn"
	"ciyon/web/admin/rigger"
	"ciyon/web/admin/wsdemo"
	c "ciyon/zciyon"
)

/*
本文件由node生成
*/
func setWebRoute_adm(web *c.CiyWebServer) {
	web.RouterFunc("/admin/rigger", map[string]map[string]func(http.ResponseWriter, *http.Request) bool{
		"logfile": {
			"init":    rigger.Logfile_init,
			"viewlog": rigger.Logfile_viewlog,
		},
		"statsfunc": {
			"init":      rigger.Statsfunc_init,
			"del":       rigger.Statsfunc_del,
			"exportxls": rigger.Statsfunc_exportxls,
		},
		"statssrv": {
			"init": rigger.Statssrv_init,
		},
		"statsdb": {
			"init": rigger.Statsdb_init,
		},
		"power": {
			"init":   rigger.Power_init,
			"update": rigger.Power_update,
			"del":    rigger.Power_del,
		},
		"mock": {
			"init":   rigger.Mock_init,
			"update": rigger.Mock_update,
			"del":    rigger.Mock_del,
		},
		"logdb": {
			"init":      rigger.Logdb_init,
			"del":       rigger.Logdb_del,
			"multiread": rigger.Logdb_multiread,
		},
		"lug": {
			"init": rigger.Lug_init,
			"del":  rigger.Lug_del,
		},
		"funcslow": {
			"init":      rigger.Funcslow_init,
			"del":       rigger.Funcslow_del,
			"exportxls": rigger.Funcslow_exportxls,
		},
		"chgpass": {
			"update": rigger.Chgpass_update,
		},
		"depart": {
			"init":       rigger.Depart_init,
			"update":     rigger.Depart_update,
			"del":        rigger.Depart_del,
			"modifyupid": rigger.Depart_modifyupid,
			"multiadd":   rigger.Depart_multiadd,
		},
		"config": {
			"init":   rigger.Config_init,
			"update": rigger.Config_update,
			"del":    rigger.Config_del,
		},
		"autotask": {
			"init":   rigger.Autotask_init,
			"update": rigger.Autotask_update,
			"del":    rigger.Autotask_del,
			"status": rigger.Autotask_status,
		},
		"autotskrun": {
			"init":      rigger.Autotskrun_init,
			"del":       rigger.Autotskrun_del,
			"exportxls": rigger.Autotskrun_exportxls,
			"viewlog":   rigger.Autotskrun_viewlog,
		},
		"admin": {
			"init":           rigger.Admin_init,
			"update":         rigger.Admin_update,
			"del":            rigger.Admin_del,
			"repass":         rigger.Admin_repass,
			"exportxls":      rigger.Admin_exportxls,
			"importxls_in":   rigger.Admin_importxls_in,
			"importxls_data": rigger.Admin_importxls_data,
		},
		"menu": {
			"init":       rigger.Menu_init,
			"update":     rigger.Menu_update,
			"del":        rigger.Menu_del,
			"modifyupid": rigger.Menu_modifyupid,
			"multiadd":   rigger.Menu_multiadd,
			"seticon":    rigger.Menu_seticon,
		},
		"debug_user": {
			"init":     rigger.Debug_user_init,
			"update":   rigger.Debug_user_update,
			"del":      rigger.Debug_user_del,
			"getlocal": rigger.Debug_user_getlocal,
		},
		"cataindex": {
			"init":   rigger.Cataindex_init,
			"update": rigger.Cataindex_update,
			"del":    rigger.Cataindex_del,
		},
		"cata": {
			"init":   rigger.Cata_init,
			"update": rigger.Cata_update,
			"del":    rigger.Cata_del,
		},
		"online": {
			"init":   rigger.Online_init,
			"del":    rigger.Online_del,
			"logout": rigger.Online_logout,
		},
		"role": {
			"init": rigger.Role_init,
			"del":  rigger.Role_del,
		},
		"role_u": {
			"init":   rigger.Role_u_init,
			"update": rigger.Role_u_update,
		},
	})
	web.RouterFunc("/admin/ap", map[string]map[string]func(http.ResponseWriter, *http.Request) bool{
		"paper": {
			"init":    ap.Paper_init,
			"update":  ap.Paper_update,
			"getdata": ap.Paper_getdata,
			"del":     ap.Paper_del,
		},
	})
	web.RouterFunc("/admin/demo", map[string]map[string]func(http.ResponseWriter, *http.Request) bool{
		"normal": {
			"list":           demo.Normal_list,
			"del":            demo.Normal_del,
			"getdata":        demo.Normal_getdata,
			"update":         demo.Normal_update,
			"audit":          demo.Normal_audit,
			"exportxls":      demo.Normal_exportxls,
			"importxls_in":   demo.Normal_importxls_in,
			"importxls_data": demo.Normal_importxls_data,
		},
	})
	web.RouterFunc("/admin/demo/dyn", map[string]map[string]func(http.ResponseWriter, *http.Request) bool{
		"sse": {
			"get":  dyn.SSE_get,
			"post": dyn.SSE_get,
		},
	})
	web.RouterFunc("/admin/autotask", map[string]map[string]func(http.ResponseWriter, *http.Request) bool{
		"task": {
			"main": autotask.Task_main,
		},
	})
	web.RouterFunc("/admin/datasse", map[string]map[string]func(http.ResponseWriter, *http.Request) bool{
		"index": {
			"demo": datasse.Index_demo,
		},
	})
	web.RouterFunc("/admin/wsdemo", map[string]map[string]func(http.ResponseWriter, *http.Request) bool{
		"go": {
			"demo": wsdemo.Wsdemo, //需nginx转发upgrade为websocket协议
		},
	})
	web.RouterFunc("/admin", map[string]map[string]func(http.ResponseWriter, *http.Request) bool{
		"welcome": {
			"init": admin.Welcome_init,
		},
		"login": {
			"login":     admin.Login_login,
			"logout":    admin.Login_logout,
			"restorage": admin.Login_restorage,
		},
		"index": {
			"init":   admin.Index_init,
			"favadd": admin.Index_favadd,
			"favdel": admin.Index_favdel,
			"setssh": admin.Index_setssh,
		},
		"upload": {
			"upload": admin.Upload_upload,
			"s3":     admin.Upload_s3,
		},
	})
}
