const express = require('express');
const router = express.Router();
const { getAllWorships, createWorship, updateWorship, deleteWorship, getFilteredWorships, getWorshipOptions, importWorships, importWorshipsNbrCsv, importWorshipsNbrPlanning, uploadImportFile, exportWorships, saveImportedWorships, importNewsletterPdf } = require('../controllers/worshipController');
const authMiddleware = require('../middleware/authMiddleware');

router.get('/', getAllWorships);
router.get('/options', getWorshipOptions);
router.post('/', authMiddleware, createWorship);
router.post('/import', authMiddleware, uploadImportFile, importWorships);
router.post('/import/nbr-planning', authMiddleware, uploadImportFile, importWorshipsNbrPlanning);
router.post('/import/nbr-csv', authMiddleware, uploadImportFile, importWorshipsNbrCsv);
router.post('/import/newsletter-pdf', authMiddleware, uploadImportFile, importNewsletterPdf);
router.post('/import/save', authMiddleware, saveImportedWorships);
router.put('/:id', authMiddleware, updateWorship);
router.delete('/:id', authMiddleware, deleteWorship);
router.get('/filtered', getFilteredWorships);
router.get('/export', authMiddleware, exportWorships);

module.exports = router;
