/**
 * GPS Module Routes
 * ERP Transportistas
 *
 * Routes for GPS devices, positions, geofences, and route segments.
 * Module: MAI-006 Tracking
 * Sprint: S1 - TASK-007
 */

import { Router } from 'express';
import { AppDataSource } from '../../config/typeorm.js';
import {
  createDispositivoGpsController,
  createPosicionGpsController,
  createSegmentoRutaController,
} from './controllers/index.js';

const router = Router();

// Create controller routers with DataSource
const dispositivoRouter = createDispositivoGpsController(AppDataSource);
const posicionRouter = createPosicionGpsController(AppDataSource);
const segmentoRouter = createSegmentoRutaController(AppDataSource);

// Mount routes
// /api/gps/dispositivos - GPS device management
router.use('/dispositivos', dispositivoRouter);

// /api/gps/posiciones - GPS position tracking
router.use('/posiciones', posicionRouter);

// /api/gps/segmentos - Route segments
router.use('/segmentos', segmentoRouter);

// Note: Geocerca operations are part of dispositivo-gps controller (linked devices)

export default router;
