import '../models/bo/dashboard_bo.dart';
import '../repositories/dashboard_repository.dart';

class DashboardService {
  final DashboardRepository _repository;

  DashboardService({required DashboardRepository repository})
      : _repository = repository;

  /// 获取经营概览看板数据
  Future<DashboardOverviewBO> getOverview() async {
    final result = await _repository.getOverview();
    if (result.success && result.data != null) {
      return result.data!;
    }
    throw Exception(result.msg);
  }

  /// 获取能耗分析数据
  Future<EnergyAnalysisBO> getEnergyAnalysis() async {
    final result = await _repository.getEnergyAnalysis();
    if (result.success && result.data != null) {
      return result.data!;
    }
    throw Exception(result.msg);
  }
}
