import express from 'express';
import {
  createFriendlyMatch,
  deleteFriendlyMatch,
  getFriendlyMatchMembers,
  listFriendlyMatches,
  updateFriendlyMatch,
  updateFriendlyMatchPlayers,
} from '../controllers/friendlyMatchController.js';
import { authenticate } from '../middleware/authMiddleware.js';
import { authorize } from '../middleware/authorizationMiddleware.js';

const router = express.Router();

router.get('/:clubId', authenticate, authorize('schedule', 'read'), listFriendlyMatches);
router.post('/:clubId', authenticate, authorize('schedule', 'write'), createFriendlyMatch);
router.put('/:clubId/:matchId', authenticate, authorize('schedule', 'write'), updateFriendlyMatch);
router.delete('/:clubId/:matchId', authenticate, authorize('schedule', 'write'), deleteFriendlyMatch);
router.patch('/:clubId/:matchId/players', authenticate, authorize('schedule', 'write'), updateFriendlyMatchPlayers);
router.get('/:clubId/members/list', authenticate, authorize('schedule', 'read'), getFriendlyMatchMembers);

export default router;
