import express from 'express';
import upload from '../lib/upload.js';
import { uploadImage, deleteImage, getUploadedImages } from '../controllers/uploadController.js';
import { authenticate } from '../middleware/auth.js';

const router = express.Router();

// POST /api/upload - Upload single image - PROTECTED
router.post('/', authenticate, upload.single('image'), uploadImage);

// GET /api/upload - Get list of uploaded images - PROTECTED
router.get('/', authenticate, getUploadedImages);

// DELETE /api/upload/:filename - Delete uploaded image - PROTECTED
router.delete('/:filename', authenticate, deleteImage);

export default router;
