part of 'categories_children_cubit.dart';

class CategoriesChildrenState {
  final List<CategoriesModel> categories;
  final bool isLoading;
  final String? errorMessage;
  final int currentPage;
  final int totalPages;

  const CategoriesChildrenState({
    this.categories = const [],
    this.isLoading = false,
    this.errorMessage,
    this.currentPage = 1,
    this.totalPages = 1,
  });

  CategoriesChildrenState copyWith({
    List<CategoriesModel>? categories,
    bool? isLoading,
    String? errorMessage,
    int? currentPage,
    int? totalPages,
  }) {
    return CategoriesChildrenState(
      categories: categories ?? this.categories,
      isLoading: isLoading ?? this.isLoading,
      errorMessage: errorMessage ?? this.errorMessage,
      currentPage: currentPage ?? this.currentPage,
      totalPages: totalPages ?? this.totalPages,
    );
  }
}

final class CategoriesChildrenInitial extends CategoriesChildrenState {
  const CategoriesChildrenInitial()
      : super(
            categories: const [],
            currentPage: 1,
            errorMessage: null,
            isLoading: false,
            totalPages: 1);
}

final class CategoriesChildrenLoading extends CategoriesChildrenState {}

final class CategoriesChildrenLoaded extends CategoriesChildrenState {
  CategoriesChildrenLoaded({
    super.categories,
    super.isLoading,
    super.errorMessage,
    super.currentPage,
    super.totalPages,
  });
}

final class CategoriesChildrenError extends CategoriesChildrenState {
  const CategoriesChildrenError(String errorMessage)
      : super(errorMessage: errorMessage);
}
