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

part of '../../persistence.dart';

/// Repository contract for diagnostic schedule snapshots.
abstract interface class ScheduleSnapshotRepository {
  /// Return the snapshot with [snapshotId] in [ownerId], or null when absent.
  Future<RepoResult<core.SchedulingStateSnapshot?>> findById({
    required core.OwnerId ownerId,
    required String snapshotId,
  });

  /// Return snapshots captured for [ownerId] that overlap [window].
  Future<RepoResult<core.Page<core.SchedulingStateSnapshot>>> findInWindow({
    required core.OwnerId ownerId,
    required core.SchedulingWindow window,
    core.PageRequest page = const core.PageRequest(),
  });

  /// Insert [snapshot] for [ownerId] and return the assigned revision.
  Future<RepoResult<core.Revision>> insert({
    required core.OwnerId ownerId,
    required core.SchedulingStateSnapshot snapshot,
  });

  /// Delete snapshots whose retention expiry is before [nowUtc].
  Future<RepoResult<int>> deleteExpired({
    required core.OwnerId ownerId,
    required DateTime nowUtc,
  });
}
