// @APIVersion 1.0.0
// @Title utimes API docs
// @Description This is utimes API docs，iOS、Android、Server developers can test every API in this page.
// @License Apache 2.0
// @LicenseUrl http://www.apache.org/licenses/LICENSE-2.0.html
package routers

import (
	"gd_management_gateway/controllers/ctrl_v1"
	"gd_management_gateway/routers/middleware"

	"github.com/astaxie/beego"
)

func init() {
	beego.ErrorHandler("404", notFound)

	ns_v1 := beego.NewNamespace("/api/v1",
		beego.NSNamespace("/base_api",
			beego.NSBefore(middleware.JwtAuth),
			beego.NSInclude(
				&ctrl_v1.BaseApiController{},
			),
		),
		beego.NSNamespace("/user_merchant",
			beego.NSBefore(middleware.JwtAuth),
			beego.NSInclude(
				&ctrl_v1.UserMerchantController{},
			),
		),

		beego.NSNamespace("/merchant_api",
			beego.NSBefore(middleware.JwtAuth),
			beego.NSInclude(
				&ctrl_v1.MerchantApiController{},
			),
		),
		beego.NSNamespace("/merchant_order",
			beego.NSInclude(
				&ctrl_v1.MerchantOrderController{},
			),
		),
		beego.NSNamespace("/merchant_h5",
			beego.NSBefore(middleware.JwtAuth),
			beego.NSInclude(
				&ctrl_v1.MerchantH5Controller{},
			),
		),
		beego.NSNamespace("/admin",
			beego.NSInclude(
				&ctrl_v1.BaseAdminController{},
			),
		),
		beego.NSNamespace("/data_api",
			beego.NSBefore(middleware.JwtAuth),
			beego.NSInclude(
				&ctrl_v1.BaseDataApiController{},
			),
		),
		beego.NSNamespace("/provider",
			beego.NSBefore(middleware.JwtAuth),
			beego.NSInclude(
				&ctrl_v1.BaseProviderController{},
			),
		),
		beego.NSNamespace("/access_log",
			beego.NSInclude(
				&ctrl_v1.BaseAccessLogController{},
			),
		),
		beego.NSNamespace("/error_code",
			beego.NSBefore(middleware.JwtAuth),
			beego.NSInclude(
				&ctrl_v1.ErrorController{},
			),
		),
		beego.NSNamespace("/h5",
			beego.NSBefore(middleware.JwtAuth),
			beego.NSInclude(
				&ctrl_v1.H5ApiController{},
			),
			beego.NSInclude(
				&ctrl_v1.H5ServiceController{},
			),
		),
		beego.NSNamespace("/service_order",
			beego.NSBefore(middleware.JwtAuth),
			beego.NSInclude(
				&ctrl_v1.ServiceOrderController{},
			),
		),
		beego.NSNamespace("/action_log",
			beego.NSBefore(middleware.JwtAuth),
			beego.NSInclude(
				&ctrl_v1.ActionLogController{},
			),
		),
		beego.NSNamespace("/auth",
			beego.NSBefore(middleware.JwtAuth),
			beego.NSInclude(
				&ctrl_v1.AuthController{},
			),
		),
		beego.NSNamespace("/crontab",
			beego.NSBefore(middleware.JwtAuth),
			beego.NSInclude(
				&ctrl_v1.CrontabController{},
			),
		),
		beego.NSNamespace("/data_editor",
			beego.NSBefore(middleware.JwtAuth),
			beego.NSInclude(
				&ctrl_v1.DataSupplementController{},
			),
		),
		beego.NSNamespace("/accounting",
			beego.NSBefore(middleware.JwtAuth),
			beego.NSInclude(
				&ctrl_v1.AccountingController{},
			),
		),
	)
	beego.AddNamespace(ns_v1)
}
