package role

import (
	"github.com/veypi/vbase/auth"
	"github.com/veypi/vigo"
)

var Router = vigo.NewRouter()

func init() {
	Router.Get("/", "List Roles", auth.VBaseAuth.PermRead("role:*"), list)
	Router.Get("/{id}", "Get Role Detail", auth.VBaseAuth.PermRead("role:*"), get)
	Router.Post("/", "Create Role", auth.VBaseAuth.PermCreate("role"), create)
	Router.Patch("/{id}", "Update Role", auth.VBaseAuth.PermWrite("role:*"), patch)
	Router.Delete("/{id}", "Delete Role", auth.VBaseAuth.PermWrite("role:*"), del)
	Router.Get("/{id}/permissions", "Get Role Permissions", auth.VBaseAuth.PermRead("role:*"), getPermissions)
	Router.Put("/{id}/permissions", "Update Role Permissions", auth.VBaseAuth.PermWrite("role:*"), updatePermissions)
}
