import 'package:hmg_patient_app/core/enum/viewstate.dart';
import 'package:hmg_patient_app/core/model/weahter/weather_model.dart';
import 'package:hmg_patient_app/core/service/weather_service.dart';
import 'package:hmg_patient_app/core/viewModels/base_view_model.dart';

import '../../../locator.dart';

class WeatherViewModel extends BaseViewModel {
  WeatherService _weatherService = locator<WeatherService>();
  List<GetCityInfoList> get weatherIndicatorData =>
      _weatherService.weatherIndicatorData;
  getWeatherData() async {
    setState(ViewState.Busy);

    // if (id != null && projectID != null) {
    //   await _erService.getProjectAvgERWaitingTimeOrders(
    //       id: id, projectID: projectID);
    // } else {
    await _weatherService.getWeatherData();
    // }
    if (_weatherService.hasError) {
      error = _weatherService.error!;
      setState(ViewState.Error);
    } else
      setState(ViewState.Idle);
  }
}
