package adminuser

import (
	"hyapp-admin-server/internal/middleware"

	"github.com/gin-gonic/gin"
)

func RegisterRoutes(protected *gin.RouterGroup, h *Handler) {
	protected.GET("/users", middleware.RequirePermission("user:view"), h.ListUsers)
	protected.POST("/users", middleware.RequirePermission("user:create"), h.CreateUser)
	protected.GET("/users/export", middleware.RequirePermission("user:export"), h.ExportUsers)
	protected.POST("/users/batch/status", middleware.RequirePermission("user:status"), h.BatchUpdateUserStatus)
	protected.GET("/users/finance-scope-assignments", middleware.RequirePermission("user:view"), h.ListMoneyScopeAssignments)
	protected.GET("/users/:id", middleware.RequirePermission("user:view"), h.GetUser)
	protected.GET("/users/:id/app-scopes", middleware.RequirePermission("user:view"), h.GetUserAppScopes)
	protected.GET("/users/:id/finance-scopes", middleware.RequirePermission("user:view"), h.ListUserMoneyScopes)
	protected.GET("/users/:id/money-scopes", middleware.RequirePermission("user:view"), h.ListUserMoneyScopes)
	protected.PATCH("/users/:id", middleware.RequirePermission("user:update"), h.UpdateUser)
	protected.PUT("/users/:id/app-scopes", middleware.RequirePermission("user:update"), h.ReplaceUserAppScopes)
	protected.PUT("/users/:id/finance-scopes", middleware.RequirePermission("user:update"), h.ReplaceUserMoneyScopes)
	protected.PUT("/users/:id/money-scopes", middleware.RequirePermission("user:update"), h.ReplaceUserMoneyScopes)
	protected.PATCH("/users/:id/status", middleware.RequirePermission("user:status"), h.UpdateUserStatus)
	protected.POST("/users/:id/reset-password", middleware.RequirePermission("user:reset-password"), h.ResetUserPassword)
}
