/**
 * @ai-summary Platform feature public API
 * @ai-context Exports for feature registration
 */
import { Pool } from 'pg';
import pool from '../../core/config/database';
import { cacheService } from '../../core/config/redis';
import { PlatformCacheService } from './domain/platform-cache.service';
import { VehicleDataService } from './domain/vehicle-data.service';

export { platformRoutes } from './api/platform.routes';
export { PlatformController } from './api/platform.controller';
export { VehicleDataService } from './domain/vehicle-data.service';
export { PlatformCacheService } from './domain/platform-cache.service';
export * from './models/requests';
export * from './models/responses';

// Singleton vehicle data service for use by other features
let vehicleDataServiceInstance: VehicleDataService | null = null;

export function getVehicleDataService(): VehicleDataService {
  if (!vehicleDataServiceInstance) {
    const platformCache = new PlatformCacheService(cacheService);
    vehicleDataServiceInstance = new VehicleDataService(platformCache);
  }
  return vehicleDataServiceInstance;
}

// Helper to get pool for VIN decode service
export function getPool(): Pool {
  return pool;
}
