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

// CRUD Posters
router.post('/', authenticate, posterController.create);
router.get('/', authenticate, posterController.list);
router.get('/favorites', authenticate, posterController.listFavorites);
router.get('/recent', authenticate, posterController.listRecent);
router.get('/:id', authenticate, posterController.getById);
router.put('/:id', authenticate, posterController.update);
router.delete('/:id', authenticate, posterController.delete);

// Azioni speciali
router.post('/:id/render', authenticate, posterController.render);
router.post('/:id/regenerate-ai', authenticate, posterController.regenerateAi);
router.get('/:id/download/:format', posterController.download);
router.post('/:id/favorite', authenticate, posterController.toggleFavorite);

// Quick generate (come nella tua bozza)
router.post('/quick-generate', authenticate, posterController.quickGenerate);

module.exports = router;