import 'package:syncrow_web/pages/analytics/models/analytics_device.dart';
import 'package:syncrow_web/pages/analytics/params/get_analytics_devices_param.dart';
import 'package:syncrow_web/pages/analytics/services/analytics_devices/analytics_devices_service.dart';

class AnalyticsDevicesServiceDelegate implements AnalyticsDevicesService {
  const AnalyticsDevicesServiceDelegate(
    this._occupancyService,
    this._energyManagementService,
  );

  final AnalyticsDevicesService _occupancyService;
  final AnalyticsDevicesService _energyManagementService;

  @override
  Future<List<AnalyticsDevice>> getDevices(
    GetAnalyticsDevicesParam param,
  ) {
    return switch (param.requestType) {
      AnalyticsDeviceRequestType.occupancy => _occupancyService.getDevices(param),
      AnalyticsDeviceRequestType.energyManagement =>
        _energyManagementService.getDevices(param),
    };
  }
}
