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

part of '../../persistence_contract.dart';

/// A stable index plan future adapters can translate to driver-specific calls.
class PersistenceIndexSpec {
  /// Creates a `PersistenceIndexSpec` 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 PersistenceIndexSpec({
    required this.name,
    required this.collection,
    required this.keys,
    this.unique = false,
    this.partialFilterFields = const <String>{},
    this.supportsQueries = const <String>{},
  });

  /// Stores the `name` 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 name;

  /// Stores the `collection` 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 collection;

  /// Stores the `keys` 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<PersistenceIndexField> keys;

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

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

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