package prettyid

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

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

func RegisterRoutes(protected *gin.RouterGroup, h *Handler) {
	if h == nil {
		return
	}

	protected.GET("/admin/users/pretty-id-pools", middleware.RequirePermission("pretty-id:view"), h.ListPools)
	protected.POST("/admin/users/pretty-id-pools", middleware.RequirePermission("pretty-id:update"), h.CreatePool)
	protected.PUT("/admin/users/pretty-id-pools/:pool_id", middleware.RequirePermission("pretty-id:update"), h.UpdatePool)
	protected.POST("/admin/users/pretty-id-pools/:pool_id/generate", middleware.RequirePermission("pretty-id:generate"), h.Generate)
	protected.GET("/admin/users/pretty-ids", middleware.RequirePermission("pretty-id:view"), h.ListIDs)
	protected.POST("/admin/users/pretty-ids/grant", middleware.RequirePermission("pretty-id:grant"), h.Grant)
	protected.POST("/admin/users/pretty-ids/:pretty_id/recycle", middleware.RequirePermission("pretty-id:update"), h.Recycle)
	protected.POST("/admin/users/pretty-ids/:pretty_id/status", middleware.RequirePermission("pretty-id:update"), h.SetStatus)
}
