import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/service/base/base_service.dart';
import 'package:doctor_app_flutter/models/dashboard/dashboard_model.dart';
import 'package:doctor_app_flutter/models/dashboard/get_special_clinical_care_List_Respose_Model.dart';

class DashboardService extends BaseService {
  List<DashboardModel> _dashboardItemsList = [];
  List<DashboardModel> get dashboardItemsList => _dashboardItemsList;
  

  bool hasVirtualClinic = false;
  String ?sServiceID;

  Future getDashboard() async {
    hasError = false;
    await baseAppClient.post(
      GET_DASHBOARD,
      onSuccess: (dynamic response, int statusCode) {
        _dashboardItemsList.clear();
        response['listDoctorDashboarKPI'].forEach((v) {
          _dashboardItemsList.add(DashboardModel.fromJson(v));
        });
      },
      onFailure: (String error, int statusCode) {
        hasError = true;
        super.error = error;
      },
      body: {
      },
    );
  }

  Future checkDoctorHasLiveCare() async {
    hasError = false;
   await getDoctorProfile(isGetProfile: true);
    await baseAppClient.post(
      DOCTOR_CHECK_HAS_LIVE_CARE,
      onSuccess: (dynamic response, int statusCode) {
        hasVirtualClinic = response['HasVirtualClinic'];
        sServiceID = response['SserviceID'];
      },
      onFailure: (String error, int statusCode) {
        hasError = true;
        super.error = error;
      },
      body: {
        "DoctorID": doctorProfile?.doctorID// test user 9920
      },
    );
  }

}
