const express = require('express');
const router = express.Router();
const deviceTokenController = require('../controllers/deviceTokenController');
const authenticateToken = require('../middleware/authMiddleware');

// Register or refresh device token
router.post('/', authenticateToken, deviceTokenController.register);

// Update preferences for a token (sound/vibration/push)
router.patch('/', authenticateToken, deviceTokenController.updatePreferences);

// Unregister device token
router.post('/unregister', authenticateToken, deviceTokenController.unregister);

// List tokens for current user
router.get('/', authenticateToken, deviceTokenController.list);

module.exports = router;
