import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';

abstract class PowerClampEvent extends Equatable {
  const PowerClampEvent();

  @override
  List<Object> get props => [];
}

class PowerClampLoading extends PowerClampEvent {}

class PowerClampSwitch extends PowerClampEvent {
  final bool switchD;
  final String deviceId;
  final String productId;
  const PowerClampSwitch({required this.switchD, this.deviceId = '', this.productId = ''});

  @override
  List<Object> get props => [switchD, deviceId, productId];
}

class PowerClampUpdated extends PowerClampEvent {}

class FetchEnergyData extends PowerClampEvent {}

class SelectDateEvent extends PowerClampEvent {
  final BuildContext context;
  const SelectDateEvent({required this.context});
}

class PowerClampInitial extends PowerClampEvent {
  const PowerClampInitial();
}

class ReportLogsInitial extends PowerClampEvent {
  final String? code;
  const ReportLogsInitial({required this.code});

  @override
  List<Object> get props => [code!];
}

class PowerClampChangeStatus extends PowerClampEvent {}

class GetCounterEvent extends PowerClampEvent {
  final String deviceCode;
  const GetCounterEvent({required this.deviceCode});
  @override
  List<Object> get props => [deviceCode];
}

class ToggleLowBatteryEvent extends PowerClampEvent {
  final bool isLowBatteryEnabled;

  const ToggleLowBatteryEvent(this.isLowBatteryEnabled);

  @override
  List<Object> get props => [isLowBatteryEnabled];
}

class ToggleClosingReminderEvent extends PowerClampEvent {
  final bool isClosingReminderEnabled;

  const ToggleClosingReminderEvent(this.isClosingReminderEnabled);

  @override
  List<Object> get props => [isClosingReminderEnabled];
}

class ToggleDoorAlarmEvent extends PowerClampEvent {
  final bool isDoorAlarmEnabled;

  const ToggleDoorAlarmEvent(this.isDoorAlarmEnabled);

  @override
  List<Object> get props => [isDoorAlarmEnabled];
}

class SetCounterValue extends PowerClampEvent {
  final Duration duration;
  final String deviceCode;
  const SetCounterValue({required this.duration, required this.deviceCode});
  @override
  List<Object> get props => [duration, deviceCode];
}

class StartTimer extends PowerClampEvent {
  final int duration;

  const StartTimer(this.duration);

  @override
  List<Object> get props => [duration];
}

class TickTimer extends PowerClampEvent {
  final int remainingTime;

  const TickTimer(this.remainingTime);

  @override
  List<Object> get props => [remainingTime];
}

class StopTimer extends PowerClampEvent {}

class OnClose extends PowerClampEvent {}

class FilterRecordsByDateEvent extends PowerClampEvent {
  final DateTime selectedDate;
  final String viewType; // 'Day', 'Month', 'Year'

  const FilterRecordsByDateEvent({required this.selectedDate, required this.viewType});
}
