package router

import (
	"github.com/gin-gonic/gin"
	"go-admin/app/admin/apis/usermanage"
	"go-admin/app/admin/middleware"
	jwt "go-admin/pkg/jwtauth"
)

// 需认证的路由代码
func registerUserManageRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
	userInfo := v1.Group("/user_info").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole())
	{
		userInfo.POST("/list", usermanage.NewUserList)
		userInfo.POST("/invite_derive", usermanage.ExportDataUser)
		userInfo.POST("/mark", usermanage.MarkUser)
		userInfo.POST("/tel", usermanage.TelList)
		userInfo.POST("/new_user_invite_record_list", usermanage.NewUserInviteRecordList)                  // 会员邀请记录
		userInfo.POST("/privilege_member/list", usermanage.PrivilegeMemberList)                            // 尊享会员列表
		userInfo.POST("/privilege_member/activate_extended_warranty", usermanage.ActivateExtendedWarranty) // 激活尊享会员主机延保
		userInfo.POST("/privilege_member/cancel_members", usermanage.CancelPrivilegeMembers)               // 取消尊享会员
	}
}

// 无需认证的路由代码
func registerUserManageUnAuthRouter(v1 *gin.RouterGroup) {
	userInfo := v1.Group("/user_info")
	{
		userInfo.POST("/add_assistant", usermanage.UserAddAssistant)
		userInfo.POST("/assistant_del", usermanage.UserAssistantDel)
		userInfo.POST("/invite_list", usermanage.UserInviteList)
		userInfo.POST("/cancel_members", usermanage.CancelMembers) // 取消租卡会员

		userInfo.POST("/user_derive", usermanage.ExportDataUserMember)
		userInfo.POST("/deposit_refund/list", usermanage.UserDepositRefundRecordList)   // 保证金审核列表
		userInfo.POST("/deposit_refund/notarize", usermanage.NotarizeUserDepositRefund) // 退押金审核
		userInfo.POST("/deposit_refund/refused", usermanage.NotarizeUserDepositRefused)
		userInfo.POST("/xcx_role_list", usermanage.XcxRoleList)
		userInfo.POST("/member_list", usermanage.UserInviteList)
		userInfo.POST("/member_record_list", usermanage.UserMemberRecordList)
		userInfo.POST("/member_record_list_export", usermanage.UserMemberRecordListExport)
		userInfo.POST("/member_statistic_list", usermanage.UserMemberStatisticList)
		userInfo.POST("/user_invite_record_list", usermanage.UserInviteRecordList)
		userInfo.POST("/expire_member_sms_list", usermanage.ExpireMemberSmsSendRecordList) // 短信记录列表

	}

	common := v1.Group("/common_problem")
	{
		common.POST("/list", usermanage.CommonProblemList)
		common.POST("/add", usermanage.CommonProblemAdd)
		common.POST("/modify", usermanage.CommonProblemModify)
		common.POST("/del", usermanage.CommonProblemDel)
	}

	article := v1.Group("/article")
	{
		article.POST("/list", usermanage.ArticleList)
		article.POST("/add", usermanage.ArticleAdd)
		article.POST("/modify", usermanage.ArticleUpdate)
		article.POST("/del", usermanage.ArticleDel)
	}

	groupSendMessage := v1.Group("/group_send_message")
	{
		groupSendMessage.POST("template/list", usermanage.GroupSendMessageCreateTemplateList)
		groupSendMessage.POST("template/add", usermanage.GroupSendMessageCreateTemplate)
		groupSendMessage.POST("template/edit", usermanage.GroupSendMessageEditTemplate)
		groupSendMessage.POST("/send", usermanage.GroupSendMessage)
		groupSendMessage.POST("template/del", usermanage.GroupSendMessageCreateTemplateDel)
	}

}
