package api

import (
	"fr.latosa-escrima/api/permissions"
	"fr.latosa-escrima/core"
)

var PermissionsRoutes = map[string]core.Handler{
	"/permissions": {
		Handler: permissions.HandlePermissions,
		Middlewares: []core.Middleware{Methods("GET"),
			HasPermissions("permissions", "get"), AuthJWT},
	},
	"/permissions/grouped": {
		Handler: permissions.HandleResourceActions,
		Middlewares: []core.Middleware{Methods("GET"),
			HasPermissions("permissions", "get"), AuthJWT},
	},
	"/permissions/resources/{resource}": {
		Handler: permissions.HandlePermissionsResource,
		Middlewares: []core.Middleware{Methods("GET"),
			HasPermissions("permissions", "get"), AuthJWT},
	},
	"/permissions/resources/{resource}/{action}": {
		Handler: permissions.HandlePermission,
		Middlewares: []core.Middleware{Methods("GET"),
			HasPermissions("permissions", "get"), AuthJWT},
	},
}
