import 'package:fl_chart/fl_chart.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:smart_hotel_app/views/home/abnormal/cubit/abnormal_state.dart';

class AbnormalCubit extends Cubit<AbnormalState> {
  AbnormalCubit() : super(AbnormalState(alarmInfo: _getAlarmInfo()));

  static AlarmInfo _getAlarmInfo() {
    return const AlarmInfo(
      alarmType: '温度异常告警',
      deviceInfo: 'A-301智能空开·客房301',
      alarmLevel: '高警',
      urgency: '紧急',
      currentTemp: '85℃',
      voltage: '22V',
      current: '3.2A',
      triggerTime: '2026-05-09 14:23:18',
      threshold: '温度>80℃触发',
      duration: '2小时37分钟',
      peak: '89.2℃ (15:02)',
      linkAction: '自动断电保护',
      date: '5月9日',
      temperatureSpots: [
        FlSpot(0, 40),
        FlSpot(4, 40),
        FlSpot(8, 15),
        FlSpot(12, 55),
        FlSpot(16, 50),
        FlSpot(18, 55),
        FlSpot(20, 75),
        FlSpot(22, 82),
        FlSpot(24, 85),
      ],
    );
  }

  void handleConfirm() {
    print('确认处理');
  }
}