import '../models/bo/alert_detail_bo.dart';
import '../repositories/alert_detail_repository.dart';

class AlertDetailService {
  final AlertDetailRepository _repository;

  AlertDetailService({required AlertDetailRepository repository})
      : _repository = repository;

  Future<AlertDetailBO> getDetail({required int alertId}) async {
    final result = await _repository.getDetail(alertId: alertId);
    if (result.success && result.data != null) {
      return result.data!;
    }
    throw Exception(result.msg);
  }

  Future<void> handleAlert({required int alertId}) async {
    final result = await _repository.handleAlert(alertId: alertId);
    if (!result.success) {
      throw Exception(result.msg);
    }
  }
}