import '../../domain/entities/alert_event.dart';
import '../../domain/repositories/alerts_repository.dart';
import '../datasources/alerts_datasource.dart';

class AlertsRepositoryImpl implements AlertsRepository {
  final AlertsDatasource _datasource;

  AlertsRepositoryImpl(this._datasource);

  @override
  Future<List<AlertEvent>> getAll({String? severity}) async {
    final models = await _datasource.fetchAll(severity: severity);
    return models.map((m) => m.toEntity()).toList();
  }

  @override
  Future<AlertEvent> acknowledge(String id) async {
    final model = await _datasource.acknowledge(id);
    return model.toEntity();
  }
}
