import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import 'package:syncrow_web/pages/roles_and_permission/users_page/add_user_dialog/model/permission_option_model.dart';
import 'package:syncrow_web/pages/roles_and_permission/users_page/add_user_dialog/model/tree_node_model.dart';

sealed class UsersEvent extends Equatable {
  const UsersEvent();
}

class SendInviteUsers extends UsersEvent {
  final BuildContext context;
  const SendInviteUsers({required this.context});
  @override
  List<Object?> get props => [context];
}

class EditInviteUsers extends UsersEvent {
  final BuildContext context;
  final String userId;
  const EditInviteUsers({required this.context, required this.userId});
  @override
  List<Object?> get props => [context, userId];
}

class CheckSpacesStepStatus extends UsersEvent {
  const CheckSpacesStepStatus();
  @override
  List<Object?> get props => [];
}

class CheckRoleStepStatus extends UsersEvent {
  const CheckRoleStepStatus();
  @override
  List<Object?> get props => [];
}

class LoadCommunityAndSpacesEvent extends UsersEvent {
  const LoadCommunityAndSpacesEvent();
  @override
  List<Object?> get props => [];
}

class RoleEvent extends UsersEvent {
  const RoleEvent();
  @override
  List<Object?> get props => [];
}

class PermissionEvent extends UsersEvent {
  final String? roleUuid;
  const PermissionEvent({this.roleUuid = ""});
  @override
  List<Object?> get props => [roleUuid];
}

class GetBatchStatus extends UsersEvent {
  final List<String> uuids;
  const GetBatchStatus(this.uuids);
  @override
  List<Object?> get props => [uuids];
}

//isEditUser:widget.userId!=''? false:true
class CheckStepStatus extends UsersEvent {
  final int? steps;
  final bool? isEditUser;
  const CheckStepStatus({this.steps, required this.isEditUser});
  @override
  List<Object?> get props => [steps];
}

class SearchAnode extends UsersEvent {
  final List<TreeNode>? nodes;
  final String? searchTerm;
  const SearchAnode({this.nodes, this.searchTerm});
  @override
  List<Object?> get props => [nodes, searchTerm];
}

class SearchPermission extends UsersEvent {
  final List<PermissionOption>? nodes;
  final String? searchTerm;
  const SearchPermission({this.nodes, this.searchTerm});
  @override
  List<Object?> get props => [nodes, searchTerm];
}

class SelectedId extends UsersEvent {
  final List<TreeNode>? nodes;
  const SelectedId({
    this.nodes,
  });
  @override
  List<Object?> get props => [nodes];
}

class ValidateBasicsStep extends UsersEvent {
  const ValidateBasicsStep();
  @override
  List<Object?> get props => [];
}

class CheckEmailEvent extends UsersEvent {
  const CheckEmailEvent();
  @override
  List<Object?> get props => [];
}

class GetUserByIdEvent extends UsersEvent {
  final String? uuid;
  const GetUserByIdEvent({this.uuid});
  @override
  List<Object?> get props => [uuid];
}

class ToggleNodeExpansion extends UsersEvent {
  final TreeNode node;

  const ToggleNodeExpansion({required this.node});

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

class UpdateNodeCheckStatus extends UsersEvent {
  final TreeNode node;

  const UpdateNodeCheckStatus({required this.node});
  @override
  List<Object?> get props => [node];
}

class ToggleNodeHighlightEvent extends UsersEvent {
  final TreeNode node;

  const ToggleNodeHighlightEvent(this.node);
  @override
  List<Object?> get props => [node];
}

class ExpandAllNodesEvent extends UsersEvent {
  @override
  List<Object?> get props => [];
}

class CollapseAllNodesEvent extends UsersEvent {
  @override
  List<Object?> get props => [];
}

class ClearSelectionsEvent extends UsersEvent {
  @override
  List<Object?> get props => [];
}

class ToggleNodeCheckEvent extends UsersEvent {
  final TreeNode node;

  const ToggleNodeCheckEvent(this.node);
  @override
  List<Object?> get props => [];
}

class ToggleNodeCheck extends UsersEvent {
  final TreeNode node;

  const ToggleNodeCheck(this.node);
  @override
  List<Object?> get props => [];
}

class EditUserEvent extends UsersEvent {
  const EditUserEvent();
  @override
  List<Object?> get props => [];
}
