// SPDX-FileCopyrightText: 2026 FocusFlow contributors
// SPDX-License-Identifier: AGPL-3.0-only

part of '../../repositories.dart';

/// One bounded page of repository query results.
class RepositoryPage<T> {
  /// Creates a `RepositoryPage` instance with the values required by its invariants.
  /// Callers should pass already-normalized scheduler data because validation and defaulting belong at the model or service boundary, not in arbitrary UI code.
  const RepositoryPage({
    required this.items,
    this.nextCursor,
  });

  /// Stores the `items` value for this object.
  /// This field is part of the explicit state that downstream scheduling, persistence, or UI code reads when composing behavior.
  final List<T> items;

  /// Stores the `nextCursor` value for this object.
  /// This field is part of the explicit state that downstream scheduling, persistence, or UI code reads when composing behavior.
  final String? nextCursor;

  /// Returns the derived `hasMore` value for this object.
  /// Keeping this as an accessor gives callers a stable read surface while the owning type controls how the value is calculated.
  bool get hasMore => nextCursor != null;
}
