import { Router } from 'express';
import * as appRecordController from '../controllers/applicationRecordController.js';
import { extractUser, requireUser } from '../middleware/roleMiddleware.js';

const router = Router();

// Public routes (read-only)
router.get('/project/:projectId', extractUser, appRecordController.getApplicationRecordsByProject);

// Protected routes (require user permission)
router.post('/', extractUser, requireUser, appRecordController.createApplicationRecord);
router.put('/:id', extractUser, requireUser, appRecordController.updateApplicationRecord);
router.delete('/:id', extractUser, requireUser, appRecordController.deleteApplicationRecord);

export default router;
