import express from 'express';
import {
  acceptFriendlyMatchInvitation,
  createFriendlyMatchInvitation,
  declineFriendlyMatchInvitation,
  listIncomingFriendlyMatchInvitations,
  listOutgoingFriendlyMatchInvitations,
} from '../controllers/friendlyMatchInvitationController.js';
import { authenticate } from '../middleware/authMiddleware.js';
import { authorize } from '../middleware/authorizationMiddleware.js';

const router = express.Router();

router.post('/:clubId', authenticate, authorize('schedule', 'write'), createFriendlyMatchInvitation);
router.get('/:clubId/incoming', authenticate, authorize('schedule', 'read'), listIncomingFriendlyMatchInvitations);
router.get('/:clubId/outgoing', authenticate, authorize('schedule', 'read'), listOutgoingFriendlyMatchInvitations);
router.post('/:clubId/:invitationId/accept', authenticate, authorize('schedule', 'write'), acceptFriendlyMatchInvitation);
router.post('/:clubId/:invitationId/decline', authenticate, authorize('schedule', 'write'), declineFriendlyMatchInvitation);

export default router;
