import { Router } from 'express'; import { authenticateToken } from '../middleware/auth.middleware'; import { validateCreateConcentrator, validateUpdateConcentrator, } from '../validators/concentrator.validator'; import * as concentratorController from '../controllers/concentrator.controller'; const router = Router(); /** * GET /concentrators * Get all concentrators with optional filters and pagination * Query params: project_id, status, page, limit, sortBy, sortOrder * Protected endpoint - requires authentication */ router.get('/', authenticateToken, concentratorController.getAll); /** * GET /concentrators/:id * Get a single concentrator by ID with gateway count * Protected endpoint - requires authentication */ router.get('/:id', authenticateToken, concentratorController.getById); /** * POST /concentrators * Create a new concentrator * Body: { serial_number, name?, project_id, location?, status?, ip_address?, firmware_version? } * Protected endpoint - requires authentication */ router.post( '/', authenticateToken, validateCreateConcentrator, concentratorController.create ); /** * PUT /concentrators/:id * Update an existing concentrator * Body: { serial_number?, name?, project_id?, location?, status?, ip_address?, firmware_version? } * Protected endpoint - requires authentication */ router.put( '/:id', authenticateToken, validateUpdateConcentrator, concentratorController.update ); /** * DELETE /concentrators/:id * Delete a concentrator (fails if gateways are associated) * Protected endpoint - requires authentication */ router.delete('/:id', authenticateToken, concentratorController.remove); export default router;