using JdeScoping.Domain.Models;
namespace JdeScoping.DataAccess.Services;
///
/// Service for managing manual data sync requests.
///
public interface IManualSyncRequestService
{
///
/// Gets all manual sync requests, optionally filtered to pending only.
///
/// If true, returns only pending requests.
/// Cancellation token.
/// A read-only list of manual sync requests.
Task> GetRequestsAsync(
bool pendingOnly = false,
CancellationToken ct = default);
///
/// Gets the next pending request in FIFO order (for processor).
///
/// Cancellation token.
/// The next pending request, or null if none exists.
Task GetNextPendingRequestAsync(CancellationToken ct = default);
///
/// Creates a new manual sync request.
///
/// The name of the ETL pipeline to sync.
/// The type of sync (mass, daily, hourly).
/// The username of the requester.
/// Cancellation token.
/// The created manual sync request.
Task CreateRequestAsync(
string pipelineName,
string syncType,
string requestedBy,
CancellationToken ct = default);
///
/// Cancels a pending request using optimistic concurrency.
/// Returns true if cancelled, false if already completed/cancelled.
///
/// The request ID.
/// The username of the user cancelling the request.
/// The row version for optimistic concurrency.
/// Cancellation token.
/// True if the request was cancelled; false if already completed or cancelled.
Task CancelRequestAsync(
int id,
string cancelledBy,
byte[] rowVersion,
CancellationToken ct = default);
///
/// Marks a request as completed using optimistic concurrency.
/// Called by the sync processor.
///
/// The request ID.
/// The row version for optimistic concurrency.
/// Cancellation token.
/// True if the request was marked completed; false if already completed or cancelled.
Task CompleteRequestAsync(
int id,
byte[] rowVersion,
CancellationToken ct = default);
}