import express from 'express';
import { authenticate } from '../middleware/authMiddleware.js';
import { authorize } from '../middleware/authorizationMiddleware.js';
import {
  addClubRequestNote,
  createClubRequest,
  listClubRequests,
  updateClubRequest,
  updateClubRequestStatus,
} from '../controllers/clubRequestController.js';

const router = express.Router();

router.get('/:clubId', authenticate, authorize('requests', 'read'), listClubRequests);
router.post('/:clubId', authenticate, authorize('requests', 'write'), createClubRequest);
router.put('/:clubId/:requestId', authenticate, authorize('requests', 'write'), updateClubRequest);
router.patch('/:clubId/:requestId/status', authenticate, authorize('requests', 'write'), updateClubRequestStatus);
router.post('/:clubId/:requestId/notes', authenticate, authorize('requests', 'write'), addClubRequestNote);

export default router;
