part of 'water_heater_bloc.dart';

sealed class WaterHeaterEvent extends Equatable {
  const WaterHeaterEvent();

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

final class ToggleWaterHeaterEvent extends WaterHeaterEvent {
  final dynamic value;
  final String deviceId;
  final String code;

  const ToggleWaterHeaterEvent({
    required this.value,
    required this.deviceId,
    required this.code,
  });

  @override
  List<Object?> get props => [value, deviceId, code];
}

final class UpdateScheduleEvent extends WaterHeaterEvent {
  final ScheduleModes scheduleMode;
  final int hours;
  final int minutes;

  const UpdateScheduleEvent({
    required this.scheduleMode,
    required this.hours,
    required this.minutes,
  });

  @override
  List<Object?> get props => [scheduleMode, hours, minutes];
}

final class StopScheduleEvent extends WaterHeaterEvent {
  final String deviceId;

  const StopScheduleEvent(this.deviceId);
}

final class WaterHeaterFetchStatusEvent extends WaterHeaterEvent {
  final String deviceId;

  const WaterHeaterFetchStatusEvent(this.deviceId);

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

final class DecrementCountdownEvent extends WaterHeaterEvent {}


class StatusUpdated extends WaterHeaterEvent {
  final WaterHeaterStatusModel deviceStatus;
  const StatusUpdated(this.deviceStatus);
  @override
  List<Object> get props => [deviceStatus];
}


final class AddScheduleEvent extends WaterHeaterEvent {
  final List<bool> selectedDays;
  final TimeOfDay time;
  final bool functionOn;
  final String category;

  const AddScheduleEvent({
    required this.selectedDays,
    required this.time,
    required this.functionOn,
    required this.category,
  });

  @override
  List<Object?> get props => [selectedDays, time, functionOn, category];
}

class EditWaterHeaterScheduleEvent extends WaterHeaterEvent {
  final String scheduleId;
  final String category;
  final TimeOfDay time;
  final bool functionOn;
  final List<bool> selectedDays;

  const EditWaterHeaterScheduleEvent({
    required this.scheduleId,
    required this.category,
    required this.time,
    required this.functionOn,
    required this.selectedDays,
  });
}

final class DeleteScheduleEvent extends WaterHeaterEvent {
  final int index;
  final String scheduleId;

  const DeleteScheduleEvent({required this.index, required this.scheduleId});

  @override
  List<Object?> get props => [index, scheduleId];
}

final class UpdateScheduleEntryEvent extends WaterHeaterEvent {
  final bool enable;
  final dynamic functionOn;
  final String deviceId;
  final int index;
  final String scheduleId;

  const UpdateScheduleEntryEvent({
    required this.enable,
    required this.functionOn,
    required this.deviceId,
    required this.scheduleId,
    required this.index,
  });

  @override
  List<Object?> get props => [enable, deviceId, scheduleId];
}

class GetSchedulesEvent extends WaterHeaterEvent {
  final String uuid;
  final String category;

  const GetSchedulesEvent({
    required this.uuid,
    required this.category,
  });

  @override
  List<Object?> get props => [uuid, category];
}

class InitializeAddScheduleEvent extends WaterHeaterEvent {
  final TimeOfDay? selectedTime;
  final List<bool>? selectedDays;
  final bool? functionOn;
  final bool isEditing;
  final int? index;

  const InitializeAddScheduleEvent({
    this.selectedTime,
    this.selectedDays,
    this.functionOn,
    this.isEditing = false,
    this.index,
  });
}

class UpdateSelectedTimeEvent extends WaterHeaterEvent {
  final TimeOfDay? selectedTime;

  const UpdateSelectedTimeEvent(this.selectedTime);

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

class UpdateSelectedDayEvent extends WaterHeaterEvent {
  final int index;
  final bool value;

  const UpdateSelectedDayEvent(this.index, this.value);

  @override
  List<Object?> get props => [index, value];
}

class UpdateFunctionOnEvent extends WaterHeaterEvent {
  final bool isOn;

  const UpdateFunctionOnEvent(this.isOn);

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

class FetchWaterHeaterBatchStatusEvent extends WaterHeaterEvent {
  final List<String> devicesUuid;
  const FetchWaterHeaterBatchStatusEvent({required this.devicesUuid});

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

class ControlWaterHeaterBatchEvent extends WaterHeaterEvent {
  final List<String> devicesUuid;
  final String code;
  final dynamic value;

  const ControlWaterHeaterBatchEvent({
    required this.devicesUuid,
    required this.code,
    required this.value,
  });

  @override
  List<Object?> get props => [devicesUuid, code, value];
}
