package routers

import (
	"spaceofcheng/services/controllers"
	"spaceofcheng/services/controllers/cases"
	"spaceofcheng/services/controllers/channel"
	"spaceofcheng/services/controllers/course"
	"spaceofcheng/services/controllers/customer"
	"spaceofcheng/services/controllers/goods"
	"spaceofcheng/services/controllers/message"
	"spaceofcheng/services/controllers/system"
	"spaceofcheng/services/controllers/user"

	"github.com/astaxie/beego"
)

func getCommonRoutes() beego.LinkNamespace {
	prefix := beego.AppConfig.String("api::common")

	return beego.NSNamespace(prefix,
		// 商品分类
		beego.NSRouter("/type/goods", &goods.GoodsController{}, "get:GetGoodsType"),
		beego.NSRouter("/type/goods/:typeid", &goods.GoodsController{}, "get:GetGoodsTypeByID"),
		beego.NSRouter("/type/goods", &goods.GoodsController{}, "post:SaveGoodsType"),
		beego.NSRouter("/type/goods/:typeid", &goods.GoodsController{}, "put:SaveGoodsType"),
		beego.NSRouter("/type/goods/:typeid", &goods.GoodsController{}, "delete:DelGoodsType"),

		// 商品规格
		beego.NSRouter("/spec/goods", &goods.GoodsController{}, "get:GetGoodsSpec"),
		beego.NSRouter("/spec/goods/:specid", &goods.GoodsController{}, "get:GetGoodsSpecByID"),
		beego.NSRouter("/spec/goods", &goods.GoodsController{}, "post:SaveGoodsSpec"),
		beego.NSRouter("/spec/goods/:specid", &goods.GoodsController{}, "put:SaveGoodsSpec"),
		beego.NSRouter("/spec/goods/:specid", &goods.GoodsController{}, "delete:DelGoodsSpec"),

		// 系统用户
		beego.NSRouter("/user", &user.UserController{}, "get:GetUserList"),
		beego.NSRouter("/user/:userid", &user.UserController{}, "get:GetUserByID"),
		beego.NSRouter("/user", &user.UserController{}, "post:SaveUser"),
		beego.NSRouter("/user", &user.UserController{}, "put:SaveUser"),
		beego.NSRouter("/user/:userid", &user.UserController{}, "delete:DelUser"),
		beego.NSRouter("/user/:userid/password", &user.UserController{}, "put:UpdatePassword"),
		beego.NSRouter("/user/password/reset", &user.UserController{}, "put:ResetPassword"),
		beego.NSRouter("/signout", &user.UserController{}, "post:SignOut"),

		// 用户类型
		beego.NSRouter("/usertype", &user.UserController{}, "get:GetUserTypes"),

		// 用户角色
		beego.NSRouter("/userrole", &user.UserController{}, "get:GetUserRole"),
		beego.NSRouter("/userrole", &user.UserController{}, "put:UserMapRole"),

		// cms 位置
		beego.NSRouter("/cms/location", &message.MessageController{}, "get:GetLocations"),
		beego.NSRouter("/cms/location/:locationid", &message.MessageController{}, "get:GetLocationById"),
		beego.NSRouter("/cms/location", &message.MessageController{}, "post:SaveLocation"),
		beego.NSRouter("/cms/location/:locationid", &message.MessageController{}, "put:SaveLocation"),
		beego.NSRouter("/cms/location/:locationid", &message.MessageController{}, "delete:DelLocation"),

		beego.NSRouter("/cms/location/:locationid/sort", &message.MessageController{}, "put:UpdateLocationSort"),

		// cms
		beego.NSRouter("/cms/info", &message.MessageController{}, "get:GetCmsInfoList"),
		beego.NSRouter("/cms/info/:infoid", &message.MessageController{}, "get:GetCmsInfoByID"),
		beego.NSRouter("/cms/info", &message.MessageController{}, "post:SaveCmsInfo"),
		beego.NSRouter("/cms/info/:infoid", &message.MessageController{}, "put:SaveCmsInfo"),
		beego.NSRouter("/cms/info/:infoid", &message.MessageController{}, "delete:DelCmsInfo"),

		// cms 图片
		beego.NSRouter("/cms/image", &message.MessageController{}, "get:GetImgList"),
		beego.NSRouter("/cms/image/:imgid", &message.MessageController{}, "get:GetImgByID"),
		beego.NSRouter("/cms/image", &message.MessageController{}, "post:SaveImage"),
		beego.NSRouter("/cms/image/:imgid", &message.MessageController{}, "put:SaveImage"),
		beego.NSRouter("/cms/image/:imgid", &message.MessageController{}, "delete:DelImg"),

		// cms 消息
		beego.NSRouter("/cms/news", &message.MessageController{}, "get:GetNews"),
		beego.NSRouter("/cms/news/:newsid", &message.MessageController{}, "get:GetNewsByID"),
		beego.NSRouter("/cms/news", &message.MessageController{}, "post:SaveNews"),
		beego.NSRouter("/cms/news/:newsid", &message.MessageController{}, "put:SaveNews"),
		beego.NSRouter("/cms/news/:newsid", &message.MessageController{}, "delete:DelNews"),

		// cms 案场
		beego.NSRouter("/cms/case", &message.MessageController{}, "get:GetCmsCase"),
		beego.NSRouter("/cms/case/:cmscaseid", &message.MessageController{}, "get:GetCmsCaseByID"),
		beego.NSRouter("/cms/case", &message.MessageController{}, "post:SaveCmsCase"),
		beego.NSRouter("/cms/case/:cmscaseid", &message.MessageController{}, "put:SaveCmsCase"),
		beego.NSRouter("/cms/case/:cmscaseid", &message.MessageController{}, "delete:DelCmsCase"),
		beego.NSRouter("/cms/caseshow/:cmscaseid", &message.MessageController{}, "put:CmsCaseShow"),
		beego.NSRouter("/cms/casehide/:cmscaseid", &message.MessageController{}, "put:CmsCaseHide"),

		// tag 标签
		beego.NSRouter("/case/tag", &cases.CaseController{}, "get:GetTagList"),
		beego.NSRouter("/case/tag/:tagid", &cases.CaseController{}, "get:GetTagByID"),
		beego.NSRouter("/case/tag", &cases.CaseController{}, "post:SaveCaseTag"),
		beego.NSRouter("/case/tag", &cases.CaseController{}, "put:SaveCaseTag"),
		beego.NSRouter("/case/tag/:tagid", &cases.CaseController{}, "delete:DelCaseTag"),

		// caseuser 案场人员
		beego.NSRouter("/case/user", &cases.CaseController{}, "get:GetCaseUserByCase"),
		beego.NSRouter("/case/userbytype", &cases.CaseController{}, "get:GetCaseUserByType"),
		beego.NSRouter("/case/user/:userid", &cases.CaseController{}, "get:GetCaseUserByID"),
		beego.NSRouter("/case/user", &cases.CaseController{}, "post:SaveCaseUser"),
		beego.NSRouter("/case/user", &cases.CaseController{}, "put:SaveCaseUser"),
		beego.NSRouter("/case/user/:userid", &cases.CaseController{}, "delete:DelCaseUser"),

		// equipment 体检设备
		beego.NSRouter("/case/equipment", &cases.CaseController{}, "get:GetEquipmentList"),
		beego.NSRouter("/case/equipment/:id", &cases.CaseController{}, "get:GetEquipmentByID"),
		beego.NSRouter("/case/equipment", &cases.CaseController{}, "post:SaveCaseEquipment"),
		beego.NSRouter("/case/equipment", &cases.CaseController{}, "put:SaveCaseEquipment"),
		beego.NSRouter("/case/equipment/:id", &cases.CaseController{}, "delete:DelCaseEquipment"),

		// case 案场
		beego.NSRouter("/case/info", &cases.CaseController{}, "get:GetCaseList"),
		beego.NSRouter("/case/info/:id", &cases.CaseController{}, "get:GetCaseByID"),
		beego.NSRouter("/case/info", &cases.CaseController{}, "post:SaveCase"),
		beego.NSRouter("/case/info", &cases.CaseController{}, "put:SaveCase"),
		beego.NSRouter("/case/info/:id", &cases.CaseController{}, "delete:DelCase"),

		// casekey 案场钥匙
		beego.NSRouter("/case/key", &cases.CaseController{}, "get:GetKeyList"),
		beego.NSRouter("/case/key", &cases.CaseController{}, "post:AddKeys"),
		beego.NSRouter("/case/unlock/:keyid", &cases.CaseController{}, "put:UnLockKey"),
		beego.NSRouter("/case/key/:keyid", &cases.CaseController{}, "delete:DelKey"),

		// casearea 案场区域
		beego.NSRouter("/case/area", &cases.CaseController{}, "get:GetCaseArea"),
		beego.NSRouter("/case/area/:areaid", &cases.CaseController{}, "get:GetCaseAreaByID"),
		beego.NSRouter("/case/area", &cases.CaseController{}, "post:SaveCaseArea"),
		beego.NSRouter("/case/area", &cases.CaseController{}, "put:SaveCaseArea"),
		beego.NSRouter("/case/area/:areaid", &cases.CaseController{}, "delete:DelCaseArea"),

		// casetable 案场桌位
		beego.NSRouter("/case/table", &cases.CaseController{}, "get:GetCaseTable"),
		beego.NSRouter("/case/table/:tableid", &cases.CaseController{}, "get:GetCaseTableByID"),
		beego.NSRouter("/case/table", &cases.CaseController{}, "post:SaveCaseTable"),
		beego.NSRouter("/case/table", &cases.CaseController{}, "put:SaveCaseTable"),
		beego.NSRouter("/case/table/:tableid", &cases.CaseController{}, "delete:DelCaseTable"),

		beego.NSRouter("/channel", &channel.ChannelController{}, "get:GetChannelList"),
		beego.NSRouter("/channel/:channelId", &channel.ChannelController{}, "get:GetChannelById"),
		beego.NSRouter("/channel", &channel.ChannelController{}, "post:SaveChannel"),
		beego.NSRouter("/channel", &channel.ChannelController{}, "put:SaveChannel"),
		beego.NSRouter("/channel/:channelId", &channel.ChannelController{}, "delete:DeleteChannel"),

		// role 角色
		beego.NSRouter("/role", &system.RoleController{}, "get:GetRoleList"),
		beego.NSRouter("/role/:roleid", &system.RoleController{}, "get:GetRoleByID"),
		beego.NSRouter("/role", &system.RoleController{}, "post:SaveCaseRole"),
		beego.NSRouter("/role", &system.RoleController{}, "put:SaveCaseRole"),
		beego.NSRouter("/role/:roleid", &system.RoleController{}, "delete:DelCaseRole"),

		beego.NSRouter("/rolemenu/:roleid", &system.RoleController{}, "get:GetRoleMenuByRole"),
		beego.NSRouter("/rolemenu/:roleid", &system.RoleController{}, "put:SaveRoleMenus"),

		// course 课程
		beego.NSRouter("/coursetag", &course.CourseController{}, "get:GetCourseTagsByPage"),
		// beego.NSRouter("/coursetag", &course.CourseController{}, "get:GetCourseTags"),

		beego.NSRouter("/course", &course.CourseController{}, "get:GetCourseList"),
		beego.NSRouter("/course/:courseid", &course.CourseController{}, "get:GetCourseByID"),
		beego.NSRouter("/course", &course.CourseController{}, "post:SaveCourse"),
		beego.NSRouter("/course", &course.CourseController{}, "put:SaveCourse"),
		beego.NSRouter("/course/:courseid", &course.CourseController{}, "delete:DeleteCourse"),
		beego.NSRouter("/course/:courseid/public", &course.CourseController{}, "put:CoursePublic"),
		beego.NSRouter("/course/:courseid/unpublic", &course.CourseController{}, "get:CourseUnPublic"),
		beego.NSRouter("/courseimg/:courseid", &course.CourseController{}, "get:GetCourseImgs"),
		beego.NSRouter("/courseimg", &course.CourseController{}, "post:SaveCourseImg"),
		beego.NSRouter("/courseimg", &course.CourseController{}, "put:SaveCourseImg"),
		beego.NSRouter("/courseimg/:courseid", &course.CourseController{}, "delete:DelCourseImg"),
		beego.NSRouter("/schedule", &course.CourseController{}, "get:GetCourseSchedule"),
		beego.NSRouter("/detail", &course.CourseController{}, "get:GetDetails"),
		beego.NSRouter("/detail/:detailid", &course.CourseController{}, "get:GetDetailByID"),
		beego.NSRouter("/detail", &course.CourseController{}, "post:SaveDetail"),
		beego.NSRouter("/detail", &course.CourseController{}, "put:SaveDetail"),
		beego.NSRouter("/detail/:detailid", &course.CourseController{}, "delete:DelCourseDetail"),

		// 商品
		beego.NSRouter("/goods", &goods.GoodsController{}, "get:GetListByCase"),
		beego.NSRouter("/goods", &goods.GoodsController{}, "post:UpdateGoods"),
		beego.NSRouter("/goods/:id", &goods.GoodsController{}, "put:UpdateGoods"),
		beego.NSRouter("/goods/:id", &goods.GoodsController{}, "delete:UpdateGoods"),

		// 商品订单
		beego.NSRouter("/order/goods", &goods.GoodsController{}, "get:GetOrderList"),
		beego.NSRouter("/order/online/goods", &goods.GoodsController{}, "get:GetOnlineOrder"),

		// 文件
		beego.NSRouter("/file", &controllers.BaseController{}, "post:FileUpload"),

		// 会员
		beego.NSRouter("/customer", &customer.CustomerController{}, "get:CustWXList"),

		// 系统相关
		beego.NSRouter("/system/init", &user.UserController{}, "get:GetEnvVars"),
	)
}
