import express from 'express';
import { authenticate } from '../middleware/authMiddleware.js';
import VocabController from '../controllers/vocabController.js';

const router = express.Router();
const vocabController = new VocabController();

router.use(authenticate);

router.get('/languages', vocabController.listLanguages);
router.post('/languages', vocabController.createLanguage);
router.post('/subscribe', vocabController.subscribe);
router.get('/languages/:languageId', vocabController.getLanguage);

// Kapitel
router.get('/languages/:languageId/chapters', vocabController.listChapters);
router.post('/languages/:languageId/chapters', vocabController.createChapter);
router.get('/languages/:languageId/vocabs', vocabController.listLanguageVocabs);
router.get('/languages/:languageId/search', vocabController.searchVocabs);

router.get('/chapters/:chapterId', vocabController.getChapter);
router.get('/chapters/:chapterId/vocabs', vocabController.listChapterVocabs);
router.post('/chapters/:chapterId/vocabs', vocabController.addVocabToChapter);

export default router;


