import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import 'package:syncrow_app/features/app_layout/model/space_model.dart';
import 'package:syncrow_app/features/devices/model/device_category_model.dart';
import 'package:syncrow_app/features/devices/model/device_control_model.dart';
import 'package:syncrow_app/features/devices/model/device_model.dart';

abstract class DeviceManagerEvent extends Equatable {
  const DeviceManagerEvent();

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

class FetchAllDevices extends DeviceManagerEvent {}

class FetchDevicesByRoomId extends DeviceManagerEvent {
  final String roomId;
  final SpaceModel unit;

  const FetchDevicesByRoomId(this.roomId, this.unit);

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

class SelectCategory extends DeviceManagerEvent {
  final int index;

  const SelectCategory(this.index);

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

class UnselectAllCategories extends DeviceManagerEvent {}

class SelectDevice extends DeviceManagerEvent {
  final DeviceModel device;

  const SelectDevice(this.device);

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

class ChangeCategorySwitchValue extends DeviceManagerEvent {
  final DevicesCategoryModel category;

  const ChangeCategorySwitchValue(this.category);

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

class TurnOnOffDevice extends DeviceManagerEvent {
  final DeviceModel device;

  const TurnOnOffDevice(this.device);

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

class ClearCategoriesSelection extends DeviceManagerEvent {
  final BuildContext context;

  const ClearCategoriesSelection(this.context);

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

class DeviceControl extends DeviceManagerEvent {
  final DeviceControlModel control;
  final String deviceId;

  const DeviceControl(this.control, this.deviceId);

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

class DeviceFunctionsEvent extends DeviceManagerEvent {
  final String deviceId;
  const DeviceFunctionsEvent(this.deviceId);

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