part of 'space_tree_dropdown_bloc.dart';

enum SpaceTreeDropdownStatus { initial, loading, success, failure }

class SpaceTreeDropdownState {
  final String? selectedSpaceId;
  final List<CommunityModel> communities;
  final List<CommunityModel> filteredCommunities;
  final SpaceTreeDropdownStatus status;
  final String? errorMessage;
  final String searchQuery;
  final bool paginationIsLoading;
  final PaginationModel? paginationModel;
  final bool isSearching;

  SpaceTreeDropdownState({
    this.selectedSpaceId,
    this.communities = const [],
    this.filteredCommunities = const [],
    this.status = SpaceTreeDropdownStatus.initial,
    this.errorMessage,
    this.searchQuery = '',
    this.paginationIsLoading = false,
    this.paginationModel,
    this.isSearching = false,
  });

  SpaceTreeDropdownState copyWith({
    String? selectedSpaceId,
    List<CommunityModel>? communities,
    List<CommunityModel>? filteredCommunities,
    SpaceTreeDropdownStatus? status,
    String? errorMessage,
    String? searchQuery,
    bool? paginationIsLoading,
    PaginationModel? paginationModel,
    bool? isSearching,
  }) {
    return SpaceTreeDropdownState(
      selectedSpaceId: selectedSpaceId ?? this.selectedSpaceId,
      communities: communities ?? this.communities,
      filteredCommunities: filteredCommunities ?? this.filteredCommunities,
      status: status ?? this.status,
      errorMessage: errorMessage ?? this.errorMessage,
      searchQuery: searchQuery ?? this.searchQuery,
      paginationIsLoading: paginationIsLoading ?? this.paginationIsLoading,
      paginationModel: paginationModel ?? this.paginationModel,
      isSearching: isSearching ?? this.isSearching,
    );
  }
}