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

class AlertListRepository {
  /// 获取告警列表
  /// [alertStatus] 告警状态码：0=待处理 2=已处理 3=误报，不传则查询全部
  Future<ResponseModel<AlertListBO>> getList({
    required int pageSize,
    required int pageNum,
    String? alertStatus,
  }) {
    final params = <String, dynamic>{
      'pageSize': pageSize,
      'pageNum': pageNum,
    };
    if (alertStatus != null) {
      params['alertStatus'] = alertStatus;
    }
    return DioRequest.instance.get<AlertListBO>(
      '/app/alert/list',
      queryParameters: params,
      fromJsonT: (data) =>
          AlertListBO.fromJson(data as Map<String, dynamic>),
    );
  }
}