/// Modèle d'alerte système
/// Correspond à SystemAlertResponse du backend
library system_alert_model;

import 'package:equatable/equatable.dart';
import 'package:json_annotation/json_annotation.dart';

part 'system_alert_model.g.dart';

@JsonSerializable(explicitToJson: true)
class SystemAlertModel extends Equatable {
  final String? id;
  final String? level; // CRITICAL, ERROR, WARNING, INFO
  final String? title;
  final String? message;
  final DateTime? timestamp;
  final bool? acknowledged;
  final String? acknowledgedBy;
  final DateTime? acknowledgedAt;
  final String? source;
  final String? alertType;
  final double? currentValue;
  final double? thresholdValue;

  const SystemAlertModel({
    this.id,
    this.level,
    this.title,
    this.message,
    this.timestamp,
    this.acknowledged,
    this.acknowledgedBy,
    this.acknowledgedAt,
    this.source,
    this.alertType,
    this.currentValue,
    this.thresholdValue,
  });

  factory SystemAlertModel.fromJson(Map<String, dynamic> json) =>
      _$SystemAlertModelFromJson(json);

  Map<String, dynamic> toJson() => _$SystemAlertModelToJson(this);

  @override
  List<Object?> get props => [
        id,
        level,
        title,
        message,
        timestamp,
        acknowledged,
        acknowledgedBy,
        acknowledgedAt,
        source,
        alertType,
        currentValue,
        thresholdValue,
      ];
}
