// @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://web.me/
// @License Apache 2.0
// @LicenseUrl http://www.apache.org/licenses/LICENSE-2.0.html
package routers

import (
	"eta/eta_mobile/controllers"
	"eta/eta_mobile/controllers/data_manage"
	"eta/eta_mobile/controllers/data_manage/correlation"
	"eta/eta_mobile/controllers/data_manage/future_good"
	"eta/eta_mobile/controllers/data_manage/line_equation"
	"eta/eta_mobile/controllers/data_manage/line_feature"
	"eta/eta_mobile/controllers/english_report"
	"eta/eta_mobile/controllers/sandbox"
	"eta/eta_mobile/controllers/semantic_analysis"

	"github.com/beego/beego/v2/server/web"
	"github.com/beego/beego/v2/server/web/filter/cors"
)

func init() {
	//解决跨域问题
	web.InsertFilter("*", web.BeforeRouter, cors.Allow(&cors.Options{
		AllowAllOrigins:  true,
		AllowMethods:     []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"},
		AllowHeaders:     []string{"Origin", "Authorization", "Access-Control-Allow-Origin", "Access-Control-Allow-Headers", "Content-Type"},
		ExposeHeaders:    []string{"Content-Length", "Access-Control-Allow-Origin", "Access-Control-Allow-Headers", "Content-Type"},
		AllowCredentials: true,
	}))
	ns := web.NewNamespace("/v1",
		web.NSNamespace("/sysuser",
			web.NSInclude(
				&controllers.SysUserController{},
			),
			web.NSInclude(
				&controllers.SysUserAuthController{},
			),
		),
		web.NSNamespace("/ppt",
			web.NSInclude(
				&controllers.PptController{},
			),
			web.NSInclude(
				&controllers.PptCommonController{},
			),
		),
		web.NSNamespace("/pptv2",
			web.NSInclude(
				&controllers.PptV2Controller{},
				&controllers.PptV2GroupController{},
			),
			web.NSInclude(
				&controllers.PptV2CommonController{},
			),
		),
		web.NSNamespace("/ppt_english",
			web.NSInclude(
				&controllers.PptEnglishController{},
				&controllers.PptEnglishGroupController{},
			),
			web.NSInclude(
				&controllers.PptEnglishCommonController{},
			),
		),
		web.NSNamespace("/datamanage",
			web.NSInclude(
				&data_manage.EdbInfoController{},
				&data_manage.EdbClassifyController{},
				&data_manage.ChartClassifyController{},
				&data_manage.ChartInfoController{},
				&data_manage.ExcelInfoController{},
				&data_manage.PredictEdbInfoController{},
			),
		),
		web.NSNamespace("/resource",
			web.NSInclude(
				&controllers.ResourceController{},
			),
		),
		web.NSNamespace("/my_chart",
			web.NSInclude(
				&data_manage.MyChartController{},
			),
		),
		web.NSNamespace("/sandbox",
			web.NSInclude(
				&sandbox.SandboxController{},
			),
		),
		web.NSNamespace("/future_good",
			web.NSInclude(
				//&future_good.FutureGoodEdbInfoController{},
				&future_good.FutureGoodChartClassifyController{},
				&future_good.FutureGoodChartInfoController{},
			),
		),
		web.NSNamespace("/correlation",
			web.NSInclude(
				&correlation.CorrelationChartClassifyController{},
				&correlation.CorrelationChartInfoController{},
			),
		),
		web.NSNamespace("/line_equation",
			web.NSInclude(
				&line_equation.LineEquationChartClassifyController{},
				&line_equation.LineEquationChartInfoController{},
			),
		),
		web.NSNamespace("/line_feature",
			web.NSInclude(
				&line_feature.LineFeaturesChartClassifyController{},
				&line_feature.LineFeaturesChartInfoController{},
			),
		),
		web.NSNamespace("/classify",
			web.NSInclude(
				&controllers.ClassifyController{},
			),
		),
		web.NSNamespace("/report",
			web.NSInclude(
				&controllers.ReportController{},
			),
			web.NSInclude(
				&controllers.ReportUploadCommonController{},
			),
		),
		web.NSNamespace("/english_report",
			web.NSInclude(
				&english_report.EnglishReportController{},
				&english_report.EnglishReportEmailController{},
			),
		),

		web.NSNamespace("/system",
			web.NSInclude(
				&controllers.SysMenuController{},
			),
			web.NSInclude(
				&controllers.SysAdminController{},
			),
		),
		web.NSNamespace("/en_permission",
			web.NSInclude(
				&english_report.EnPermissionController{},
			),
		),
		web.NSNamespace("/user_login",
			web.NSInclude(
				&controllers.UserLoginController{},
				&controllers.UserLoginAuthController{},
			),
		),
		web.NSNamespace("/semantic_analysis",
			web.NSInclude(
				&semantic_analysis.SaCompareController{},
			),
		),
	)
	web.AddNamespace(ns)
}
