import '../utils/http/response_model.dart';
import '../utils/http/dio_request.dart';
import '../models/bo/alert_detail_bo.dart';

class AlertDetailRepository {
  /// 获取告警详情
  Future<ResponseModel<AlertDetailBO>> getDetail({required int alertId}) {
    return DioRequest.instance.get<AlertDetailBO>(
      '/app/alert/detail',
      queryParameters: {'alertId': alertId},
      fromJsonT: (data) =>
          AlertDetailBO.fromJson(data as Map<String, dynamic>),
    );
  }

  /// 确认处理告警
  Future<ResponseModel<Map<String, dynamic>>> handleAlert({required int alertId}) {
    return DioRequest.instance.post<Map<String, dynamic>>(
      '/app/alert/handle',
      data: {'alertId': alertId,'handleResult':'1.检查输入电压是否正常;2.确认设备是否正常运行;3.若异常，请联系电工。'},
    );
  }
}