package router

import (
	"github.com/gin-gonic/gin"
	mhayaGin "github.com/mhaya/components/gin"
	cfacade "github.com/mhaya/facade"
	"github.com/mhaya/game/game_cluster/nodes/webadmin/controller"
)

type Controller struct {
	mhayaGin.BaseController
}

func (c *Controller) Init() {
	c.SetRouter()
}

// CreateUserController 创建用户的控制
func (c *Controller) CreateUserController() {
	// parentActor := &user.User{}
	// c.CreateActor(parentActor.AliasID(), parentActor)
}

func (c *Controller) CreateActor(id string, handler cfacade.IActorHandler) {
	// system := bcwinActor.NewSystem()
	// system.SetApp(c.App)
	// system.CreateActor(id, handler)
}

// SetRouter 设置路由
func (c *Controller) SetRouter() {
	u := c.Group("/v1")
	uu := u.Group("/admin")
	uu.POST("/user/login", controller.NewAdmin().Login)

	c.InitApiRouter(uu)
}

func (c *Controller) InitApiRouter(u *gin.RouterGroup) {
	u.Use(Auth())
	u.POST("/user/log/total", controller.NewSynthesis().FindUserLogTotal)
	u.POST("/user/log/daily", controller.NewSynthesis().FindUserLogDaily)
	u.POST("/user/retention", controller.NewSynthesis().FindUserRetention)
	u.POST("/user/country", controller.NewSynthesis().FindUserCountryCount)
	u.POST("/user/withdrawal", controller.NewSynthesis().FindWithdrawal)
	u.POST("/user/withdrawal/status", controller.NewSynthesis().WithdrawalStatus)
	u.POST("/user/withdrawal/status_batch", controller.NewSynthesis().WithdrawalStatusBatch)
	u.POST("/user/level", controller.NewSynthesis().FindUserLevel)
	u.POST("/user/changePassword", controller.NewAdmin().ChangePassword)
	u.POST("/user/add", controller.NewAdmin().Add)
	u.POST("/user/del", controller.NewAdmin().Del)
	u.POST("/user/find", controller.NewAdmin().FindAll)
	u.POST("/user/update", controller.NewAdmin().UpdateStatus)
	u.POST("/user/server_status", controller.NewAdmin().GetServerStatus)
	u.POST("/role/add", controller.NewRole().Add)
	u.POST("/role/update", controller.NewRole().Update)
	u.POST("/role/del", controller.NewRole().Del)
	u.POST("/role/list", controller.NewRole().List)
	u.POST("/role/access/add", controller.NewRole().AddAccess)
	u.POST("/role/access/del", controller.NewRole().DelAccess)
	u.POST("/role/access/list", controller.NewRole().ListAccess)
	u.POST("/role/access/update", controller.NewRole().UpdateAccess)
	u.POST("/role/role_access/add", controller.NewRole().AddRoleAccess)
	u.POST("/role/role_access/del", controller.NewRole().DelRoleAccess)
	u.POST("/role/role_access/list", controller.NewRole().GetRoleAccessList)
	u.POST("/role/role_access/update", controller.NewRole().UpdateRoleAccess)
	u.POST("/role/admin_unbind_role", controller.NewRole().AdminUnBindRole)
	u.POST("/role/admin_bind_role", controller.NewRole().AdminBindRole)
	u.POST("/role/admin_role_info", controller.NewRole().GetAdminRole)
	u.POST("/whitelist/add", controller.NewWhitelist().AddWhitelist)
	u.POST("/whitelist/remove", controller.NewWhitelist().RemoveWhitelist)
	u.POST("/whitelist/list", controller.NewWhitelist().GetWhitelist)
	u.POST("/player/list", controller.NewPlayerManage().GetPlayerlist)
	u.POST("/player/info", controller.NewPlayerManage().GetPlayerInfo)
	u.POST("/player/rewardList", controller.NewPlayerManage().GetRewardList)
}

// func (c *Controller) InitMdb() {
// 	MdbAdmin, _ = mdb.InitializeMongoDB()
// }
