import 'package:equatable/equatable.dart';
import '../../models/file_item.dart';

class Breadcrumb extends Equatable {
  final String name;
  final String path;

  const Breadcrumb({required this.name, required this.path});

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

abstract class FileBrowserState extends Equatable {
  const FileBrowserState();

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

class DirectoryInitial extends FileBrowserState {}

class DirectoryLoading extends FileBrowserState {}

class DirectoryLoaded extends FileBrowserState {
  final List<FileItem> files;
  final List<FileItem> filteredFiles;
  final List<FileItem> paginatedFiles;
  final List<Breadcrumb> breadcrumbs;
  final String currentPath;
  final int currentPage;
  final int pageSize;
  final int totalPages;
  final String sortBy;
  final bool isAscending;

  const DirectoryLoaded({
    required this.files,
    required this.filteredFiles,
    required this.paginatedFiles,
    required this.breadcrumbs,
    required this.currentPath,
    required this.currentPage,
    required this.pageSize,
    required this.totalPages,
    required this.sortBy,
    required this.isAscending,
  });

  @override
  List<Object> get props => [
    files,
    filteredFiles,
    paginatedFiles,
    breadcrumbs,
    currentPath,
    currentPage,
    pageSize,
    totalPages,
    sortBy,
    isAscending,
  ];
}

class DirectoryEmpty extends FileBrowserState {
  final String currentPath;

  const DirectoryEmpty(this.currentPath);

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

class DirectoryError extends FileBrowserState {
  final String error;

  const DirectoryError(this.error);

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