part of 'attachments_bloc.dart';

abstract class AttachmentsEvent extends Equatable {
  const AttachmentsEvent();

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

/// Chiamato quando l'entità "padre" (es. il Ticket) viene salvata per la prima volta
class ParentEntitySavedEvent extends AttachmentsEvent {
  final String newParentId;
  const ParentEntitySavedEvent(this.newParentId);

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

class LoadAttachmentsEvent extends AttachmentsEvent {
  final String? parentId;
  const LoadAttachmentsEvent({this.parentId});
}

class AddAttachmentsEvent extends AttachmentsEvent {
  final List<PlatformFile> files;
  const AddAttachmentsEvent(this.files);
}

class UploadAttachmentsEvent extends AttachmentsEvent {
  final List<PlatformFile>? pickedFiles;
  final List<XFile>? photos;
  final String companyId;
  const UploadAttachmentsEvent({
    this.pickedFiles,
    this.photos,
    required this.companyId,
  });
}

class DeleteAttachmentsEvent extends AttachmentsEvent {}

class ToggleAttachmentSelectionEvent extends AttachmentsEvent {
  final AttachmentModel file;
  const ToggleAttachmentSelectionEvent(this.file);
}

class SelectAllAttachmentsEvent extends AttachmentsEvent {}

class ClearAttachmentSelectionEvent extends AttachmentsEvent {}

class LinkAttachmentsToEntityEvent extends AttachmentsEvent {
  final AttachmentParentType targetType;
  final String targetId;

  const LinkAttachmentsToEntityEvent({
    required this.targetType,
    required this.targetId,
  });

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

class RenameAttachmentEvent extends AttachmentsEvent {
  final AttachmentModel file;
  final String newName;
  const RenameAttachmentEvent(this.file, this.newName);
}

class DeleteSpecificAttachmentEvent extends AttachmentsEvent {
  final AttachmentModel file;
  const DeleteSpecificAttachmentEvent(this.file);
}
