part of 'routine_bloc.dart';

abstract class RoutineEvent extends Equatable {
  const RoutineEvent();

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

class AddToIfContainer extends RoutineEvent {
  final Map<String, dynamic> item;
  final bool isTabToRun;

  const AddToIfContainer(this.item, this.isTabToRun);

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

class AddToThenContainer extends RoutineEvent {
  final Map<String, dynamic> item;

  const AddToThenContainer(this.item);

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

class LoadScenes extends RoutineEvent {
  // final String spaceId;
  // final String communityId;
  // final BuildContext context;

  const LoadScenes();

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

class LoadAutomation extends RoutineEvent {
  // final String spaceId;
  // final BuildContext context;

  const LoadAutomation();

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

class AddFunctionToRoutine extends RoutineEvent {
  final List<DeviceFunctionData> functions;
  final String uniqueCustomId;
  const AddFunctionToRoutine(this.functions, this.uniqueCustomId);
  @override
  List<Object> get props => [functions, uniqueCustomId];
}

class RemoveFunction extends RoutineEvent {
  final DeviceFunctionData function;
  const RemoveFunction(this.function);
  @override
  List<Object> get props => [function];
}

class SearchRoutines extends RoutineEvent {
  final String query;
  const SearchRoutines(this.query);
  @override
  List<Object> get props => [query];
}

class AddSelectedIcon extends RoutineEvent {
  final String icon;
  const AddSelectedIcon(this.icon);
  @override
  List<Object> get props => [icon];
}

class CreateSceneEvent extends RoutineEvent {
  const CreateSceneEvent();
  @override
  List<Object> get props => [];
}

class RemoveDragCard extends RoutineEvent {
  final int index;
  final bool isFromThen;
  final String key;
  const RemoveDragCard({required this.index, required this.isFromThen, required this.key});
  @override
  List<Object> get props => [index, isFromThen, key];
}

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

class EffectiveTimePeriodEvent extends RoutineEvent {
  final EffectiveTime effectiveTime;
  const EffectiveTimePeriodEvent(this.effectiveTime);
  @override
  List<Object> get props => [effectiveTime];
}

class CreateAutomationEvent extends RoutineEvent {
  final String? automationId;
  final bool updateAutomation;

  const CreateAutomationEvent({
    this.automationId,
    this.updateAutomation = false,
  });
  @override
  List<Object> get props => [];
}

class SetRoutineName extends RoutineEvent {
  final String name;
  const SetRoutineName(this.name);
  @override
  List<Object> get props => [name];
}

class GetSceneDetails extends RoutineEvent {
  final String sceneId;
  final bool isUpdate;
  final bool isTabToRun;
  const GetSceneDetails({
    required this.sceneId,
    required this.isUpdate,
    required this.isTabToRun,
  });
  @override
  List<Object> get props => [sceneId];
}

class GetAutomationDetails extends RoutineEvent {
  final String automationId;
  final bool isUpdate;
  final bool isAutomation;
  const GetAutomationDetails({
    required this.automationId,
    this.isUpdate = false,
    this.isAutomation = false,
  });
  @override
  List<Object> get props => [automationId];
}

class InitializeRoutineState extends RoutineEvent {
  final RoutineDetailsModel routineDetails;
  const InitializeRoutineState(this.routineDetails);
  @override
  List<Object> get props => [routineDetails];
}

class DeleteScene extends RoutineEvent {
  const DeleteScene();
  @override
  List<Object> get props => [];
}

// class DeleteAutomation extends RoutineEvent {
//   final String automationId;
//   const DeleteAutomation({required this.automationId});
//   @override
//   List<Object> get props => [automationId];
// }

class UpdateScene extends RoutineEvent {
  const UpdateScene();
  @override
  List<Object> get props => [];
}

class UpdateAutomation extends RoutineEvent {
  const UpdateAutomation();
  @override
  List<Object> get props => [];
}

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

class TriggerSwitchTabsEvent extends RoutineEvent {
  final bool isRoutineTab;
  const TriggerSwitchTabsEvent({required this.isRoutineTab});
  @override
  List<Object> get props => [isRoutineTab];
}

class CreateNewRoutineViewEvent extends RoutineEvent {
  final bool createRoutineView;
  const CreateNewRoutineViewEvent({required this.createRoutineView});
  @override
  List<Object> get props => [createRoutineView];
}

class FetchDevicesInRoutine extends RoutineEvent {}

class ResetRoutineState extends RoutineEvent {}

class ClearFunctions extends RoutineEvent {}

class ResetErrorMessage extends RoutineEvent {}




class SceneTrigger extends RoutineEvent {
  final String? sceneId;
  final String? name;

  const SceneTrigger({this.sceneId, this.name});

  @override
  List<Object> get props => [sceneId!,name!];
}

//updateAutomationStatus
class UpdateAutomationStatus extends RoutineEvent {
  final String automationId;
  final AutomationStatusUpdate automationStatusUpdate;
  final String communityId;

  const UpdateAutomationStatus({required this.automationStatusUpdate, required this.automationId, required this.communityId});

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