const express = require('express');
const router = express.Router();
const templateController = require('../controllers/templateController');
const { authenticate } = require('../middleware/authenticate');

// CRUD Templates
router.post('/', authenticate, templateController.create);
router.get('/', templateController.list);
router.get('/types', templateController.getTypes);
router.get('/presets', templateController.getFormatPresets);
router.get('/:id', templateController.getById);
router.put('/:id', authenticate, templateController.update);
router.delete('/:id', authenticate, templateController.delete);
router.post('/:id/duplicate', authenticate, templateController.duplicate);
router.get('/:id/preview', templateController.getPreview);

module.exports = router;