import 'package:fl_chart/fl_chart.dart';

class AlarmInfo {
  final String alarmType;
  final String deviceInfo;
  final String alertLevelText;
  final String urgency;
  final String currentTemp;
  final String voltage;
  final String current;
  final String triggerTime;
  final String threshold;
  final String duration;
  final String peak;
  final String linkAction;
  final String chartTitle;
  final String date;
  final String unit;
  final double yaxisMax;
  final double yaxisMin;
  final List<String> temperatureTimes;
  final List<FlSpot> temperatureSpots;
  final String alertDeviceId;
  final int alertCount;
  final String alertIcon;

  const AlarmInfo({
    required this.alarmType,
    required this.deviceInfo,
    required this.alertLevelText,
    required this.urgency,
    required this.currentTemp,
    required this.voltage,
    required this.current,
    required this.triggerTime,
    required this.threshold,
    required this.duration,
    required this.peak,
    required this.linkAction,
    required this.chartTitle,
    required this.date,
    required this.unit,
    required this.yaxisMax,
    required this.yaxisMin,
    required this.temperatureTimes,
    required this.temperatureSpots,
    required this.alertDeviceId,
    required this.alertCount,
    required this.alertIcon,
  });
}

class AbnormalState {
  final bool isLoading;
  final String? error;
  final AlarmInfo? alarmInfo;
  final bool isHandling;
  final bool isHandled;

  const AbnormalState({
    this.isLoading = false,
    this.error,
    this.alarmInfo,
    this.isHandling = false,
    this.isHandled = false,
  });

  AbnormalState copyWith({
    bool? isLoading,
    String? error,
    AlarmInfo? alarmInfo,
    bool? isHandling,
    bool? isHandled,
  }) {
    return AbnormalState(
      isLoading: isLoading ?? this.isLoading,
      error: error ?? this.error,
      alarmInfo: alarmInfo ?? this.alarmInfo,
      isHandling: isHandling ?? this.isHandling,
      isHandled: isHandled ?? this.isHandled,
    );
  }
}
