package router

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

func RegisterAPI(group, public *gin.RouterGroup, engine *gin.Engine, h *API) {
	api := group.Group("/api")
	api.POST("/getApiList", h.List)
	api.POST("/getAllApis", h.All)
	api.POST("/createApi", h.Create)
	api.POST("/updateApi", h.Update)
	api.POST("/deleteApi", h.Delete)
	api.DELETE("/deleteApisByIds", h.DeleteByIDs)
	api.POST("/getApiById", h.Find)
	api.GET("/getApiGroups", h.Groups)
	api.GET("/getApiRoles", h.Roles)
	api.POST("/setApiRoles", h.SetRoles)
	api.GET("/syncApi", h.Sync(engine))
	api.POST("/ignoreApi", h.Ignore)
	api.POST("/enterSyncApi", h.ApplySync)
	group.Group("/api").GET("/freshCasbin", h.FreshCasbin)
	casbin := group.Group("/casbin")
	casbin.POST("/updateCasbin", h.SetPolicyPaths)
	casbin.POST("/getPolicyPathByAuthorityId", h.PolicyPaths)
}
