const express = require('express');
const router = express.Router();
const paymentController = require('../controllers/paymentController');
const { protect } = require('../middleware/authMiddleware');

router.post('/create-checkout-session', protect, paymentController.createCheckoutSession);
router.post('/create-subscription', protect, paymentController.createSubscription);
router.post('/confirm-subscription', protect, paymentController.confirmSubscription);
router.post('/cancel-subscription', protect, paymentController.cancelSubscription);
router.post('/cancel-subscription-immediately', protect, paymentController.cancelSubscriptionImmediately);
router.post('/webhook', express.raw({ type: 'application/json' }), paymentController.handlePaymentWebhook);

module.exports = router;
