package api

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

var MediaRoutes = map[string]core.Handler{
	"/media/upload": {
		Handler: media.HandleUpload,
		Middlewares: []core.Middleware{Methods("POST"),
			HasPermissions("media", "insert"), AuthJWT}},
	"/media/verify": {
		Handler: media.HandleVerify,
		Middlewares: []core.Middleware{Methods("POST"),
			HasPermissions("media", "insert"), AuthJWT},
	},
	// Paginated media response
	"/media": {
		Handler:     media.HandleMedia,
		Middlewares: []core.Middleware{Methods("GET")},
	},
	// Unique element
	"/media/{media_uuid}": {
		Handler:     media.HandleMediaDetails,
		Middlewares: []core.Middleware{Methods("GET")},
	},
	// Get the image, video, GIF etc.
	"/media/{media_uuid}/file": {
		Handler:     media.HandleMediaFile,
		Middlewares: []core.Middleware{Methods("GET")},
	},
	"/media/{media_uuid}/update": {
		Handler: media.HandleUpdate,
		Middlewares: []core.Middleware{Methods("PATCH"),
			HasPermissions("media", "update"), AuthJWT},
	},
	"/media/{media_uuid}/delete": {
		Handler: media.HandleDelete,
		Middlewares: []core.Middleware{Methods("DELETE"),
			HasPermissions("media", "delete"), AuthJWT},
	},
}
