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

part of '../../../../application_layer.dart';

/// Repository contract for owner settings.
abstract interface class OwnerSettingsRepository {
  /// Runs the `findByOwnerId` operation and completes after its asynchronous work finishes.
  /// Callers should await the returned future so repository writes, UI refreshes, and failure handling happen in a predictable order.
  Future<OwnerSettings?> findByOwnerId(String ownerId);

  /// Runs the `findRecordByOwnerId` operation and completes after its asynchronous work finishes.
  /// Callers should await the returned future so repository writes, UI refreshes, and failure handling happen in a predictable order.
  Future<RepositoryRecord<OwnerSettings>?> findRecordByOwnerId(String ownerId);

  /// Runs the `save` operation and completes after its asynchronous work finishes.
  /// Callers should await the returned future so repository writes, UI refreshes, and failure handling happen in a predictable order.
  Future<void> save(OwnerSettings settings);

  /// Runs the `saveIfRevision` operation and completes after its asynchronous work finishes.
  /// Callers should await the returned future so repository writes, UI refreshes, and failure handling happen in a predictable order.
  Future<RepositoryMutationResult> saveIfRevision({
    required OwnerSettings settings,
    required int expectedRevision,
  });
}
