import express from 'express';
import {
  deleteSharedFriendlyMatch,
  findSharedFriendlyMatches,
  getSharedFriendlyMatchMembers,
  listSharedFriendlyMatches,
  updateSharedFriendlyMatch,
  updateSharedFriendlyMatchPlayers,
} from '../controllers/friendlyMatchSharedController.js';
import { authenticate } from '../middleware/authMiddleware.js';
import { authorize } from '../middleware/authorizationMiddleware.js';

const router = express.Router();

router.get('/find', authenticate, authorize('schedule', 'read'), findSharedFriendlyMatches);
router.get('/shared/:clubId', authenticate, authorize('schedule', 'read'), listSharedFriendlyMatches);
router.get('/shared/:clubId/:matchId/members/:side', authenticate, authorize('schedule', 'read'), getSharedFriendlyMatchMembers);
router.put('/shared/:clubId/:matchId', authenticate, authorize('schedule', 'write'), updateSharedFriendlyMatch);
router.patch('/shared/:clubId/:matchId/players', authenticate, authorize('schedule', 'write'), updateSharedFriendlyMatchPlayers);
router.delete('/shared/:clubId/:matchId', authenticate, authorize('schedule', 'write'), deleteSharedFriendlyMatch);

export default router;
