const express = require("express");
const { requireAuth } = require("../middleware/authMiddleware");
const { uploadSingleFile } = require("../services/storageService");
const {
  listFilesController,
  uploadFileController,
  createFolderController,
  downloadFileController,
  deleteEntryController
} = require("../controllers/filesController");

const router = express.Router();

router.get("/files", requireAuth, listFilesController);
router.post("/files", requireAuth, uploadSingleFile, uploadFileController);
router.post("/folders", requireAuth, createFolderController);
router.get("/files/:id/download", requireAuth, downloadFileController);
router.delete("/entries/:id", requireAuth, deleteEntryController);

module.exports = router;
