package policyconfig

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/policy-templates", middleware.RequirePermission("policy-template:view"), h.ListTemplates)
	protected.POST("/admin/policy-templates", middleware.RequirePermission("policy-template:create"), h.CreateTemplate)
	protected.GET("/admin/policy-instances", middleware.RequirePermission("policy-template:view"), h.ListInstances)
	protected.POST("/admin/policy-instances", middleware.RequirePermission("policy-instance:create"), h.CreateInstance)
	protected.POST("/admin/policy-instances/:instance_id/publish", middleware.RequirePermission("policy-instance:publish"), h.PublishInstance)
	protected.PUT("/admin/policy-instances/:instance_id/status", middleware.RequirePermission("policy-instance:update"), h.UpdateInstanceStatus)
}
