'use strict';

const express = require('express');
const LocalController = require('../controllers/local');
const md_auth = require('../middleware/authenticated');
const api = express.Router();

// Rutas para gestión de locales (solo administradores)
api.get('/locales', md_auth.ensureAuth, LocalController.listarLocales);
api.get('/locales/:id', md_auth.ensureAuth, LocalController.obtenerLocal);
api.post('/locales', md_auth.ensureAuth, LocalController.registrarLocal);
api.put('/locales/:id', md_auth.ensureAuth, LocalController.actualizarLocal);
api.delete('/locales/:id', md_auth.ensureAuth, LocalController.eliminarLocal);

module.exports = api;
