import 'package:equatable/equatable.dart';
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/tag.dart';
import 'package:syncrow_web/pages/spaces_management/space_model/models/space_template_model.dart';
import 'package:syncrow_web/pages/spaces_management/space_model/models/subspace_template_model.dart';

abstract class CreateSpaceModelEvent extends Equatable {
  const CreateSpaceModelEvent();

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

class LoadSpaceTemplate extends CreateSpaceModelEvent {}

class UpdateSpaceTemplate extends CreateSpaceModelEvent {
  final SpaceTemplateModel spaceTemplate;
  List<String>? allModels;

  UpdateSpaceTemplate(this.spaceTemplate,this.allModels);
}

class CreateSpaceTemplate extends CreateSpaceModelEvent {
  final SpaceTemplateModel spaceTemplate;
  final Function(SpaceTemplateModel)? onCreate;

  const CreateSpaceTemplate({
    required this.spaceTemplate,
    this.onCreate,
  });

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

class UpdateSpaceTemplateName extends CreateSpaceModelEvent {
  final String name;
  final List<String> allModels;

  UpdateSpaceTemplateName({required this.name, required this.allModels});

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

class AddSubspacesToSpaceTemplate extends CreateSpaceModelEvent {
  final List<SubspaceTemplateModel> subspaces;

  AddSubspacesToSpaceTemplate(this.subspaces);
}

class AddTagsToSpaceTemplate extends CreateSpaceModelEvent {
  final List<Tag> tags;

  AddTagsToSpaceTemplate(this.tags);
}

class ValidateSpaceTemplateName extends CreateSpaceModelEvent {
  final String name;

  ValidateSpaceTemplateName({required this.name});
}

class ModifySpaceTemplate extends CreateSpaceModelEvent {
  final SpaceTemplateModel spaceTemplate;
  final SpaceTemplateModel updatedSpaceTemplate;
  final Function(SpaceTemplateModel)? onUpdate;

  ModifySpaceTemplate(
      {required this.spaceTemplate,
      required this.updatedSpaceTemplate,
      this.onUpdate});
}
