package api

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

var ShortcodesRoutes = map[string]core.Handler{
	"/shortcodes/new": {
		Handler: shortcodes.HandleNew,
		Middlewares: []core.Middleware{Methods("POST"),
			HasPermissions("shortcodes", "insert"), AuthJWT},
	},
	"/shortcodes": {
		Handler: shortcodes.HandleShortcodes,
		Middlewares: []core.Middleware{Methods("GET"),
			HasPermissions("shortcodes", "get"), AuthJWT},
	},
	"/shortcodes/{shortcode}": {
		Handler:     shortcodes.HandleShortcode,
		Middlewares: []core.Middleware{Methods("GET")},
	},
	"/shortcodes/{shortcode}/delete": {
		Handler: shortcodes.HandleDelete,
		Middlewares: []core.Middleware{Methods("DELETE"),
			HasPermissions("shortcodes", "delete"), AuthJWT},
	},
	"/shortcodes/{shortcode}/update": {
		Handler: shortcodes.HandleUpdate,
		Middlewares: []core.Middleware{Methods("PATCH"),
			HasPermissions("shortcodes", "update"), AuthJWT},
	},
}
