package api

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

var LocationsRoutes = map[string]core.Handler{
	"GET /locations/all": {
		Handler:     locations.HandleLocations,
		Middlewares: []core.Middleware{Methods("GET")},
	},
	"/locations/new": {
		Handler: locations.HandleNew,
		Middlewares: []core.Middleware{Methods(("POST")),
			HasPermissions("locations", "insert"), AuthJWT}},
	"GET /locations": {
		Handler:     locations.HandleLocation,
		Middlewares: []core.Middleware{Methods("GET")}},
	"DELETE /locations": {
		Handler: locations.HandleDelete,
		Middlewares: []core.Middleware{Methods("DELETE"),
			HasPermissions("locations", "delete"), AuthJWT},
	},
	"PATCH /locations": {
		Handler: locations.HandleUpdate,
		Middlewares: []core.Middleware{Methods("PATCH"),
			HasPermissions("blogs", "update"), AuthJWT},
	},
}
