package api

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

var EventsRoutes = map[string]core.Handler{
	"/events": {
		Handler:     events.HandleEvents,
		Middlewares: []core.Middleware{Methods("GET")}},
	"/events/new": {
		Handler: events.HandleNew,
		Middlewares: []core.Middleware{Methods("POST"),
			HasPermissions("events", "insert"), AuthJWT}},
	"/events/{event_uuid}": {
		Handler:     events.HandleEvent,
		Middlewares: []core.Middleware{Methods("GET")}},
	"/events/{event_uuid}/delete": {
		Handler: events.HandleDelete,
		Middlewares: []core.Middleware{Methods("DELETE"),
			HasPermissions("events", "delete"), AuthJWT}},
	"/events/{event_uuid}/update": {
		Handler: events.HandleUpdate,
		Middlewares: []core.Middleware{
			Methods("PATCH"),
			HasPermissions("events", "update"),
			AuthJWT}},
}
