// -----------------------------------------------------------------------------
// IHlcSchedulerDequeueService.cs
// Sprint: SPRINT_20260105_002_002_SCHEDULER_hlc_queue_chain
// Task: SQC-010 - Implement HlcSchedulerDequeueService
// -----------------------------------------------------------------------------
using StellaOps.HybridLogicalClock;
using StellaOps.Scheduler.Queue.Models;
namespace StellaOps.Scheduler.Queue.Services;
///
/// Service for HLC-ordered job dequeue with chain verification.
///
public interface IHlcSchedulerDequeueService
{
///
/// Dequeue jobs in HLC order (ascending) for a tenant/partition.
///
/// Tenant identifier.
/// Optional partition key (null for all partitions).
/// Maximum jobs to return.
/// Cancellation token.
/// Jobs ordered by HLC timestamp (ascending).
Task> DequeueAsync(
string tenantId,
string? partitionKey,
int limit,
CancellationToken ct = default);
///
/// Dequeue jobs within an HLC timestamp range.
///
/// Tenant identifier.
/// Start HLC (inclusive, null for no lower bound).
/// End HLC (inclusive, null for no upper bound).
/// Cancellation token.
/// Jobs ordered by HLC timestamp within the range.
Task> DequeueByRangeAsync(
string tenantId,
HlcTimestamp? startT,
HlcTimestamp? endT,
CancellationToken ct = default);
///
/// Get a specific job by its ID.
///
/// Job identifier.
/// Cancellation token.
/// The job if found, null otherwise.
Task GetByJobIdAsync(
Guid jobId,
CancellationToken ct = default);
///
/// Get a job by its chain link.
///
/// Chain link hash.
/// Cancellation token.
/// The job if found, null otherwise.
Task GetByLinkAsync(
byte[] link,
CancellationToken ct = default);
///
/// Count jobs within an HLC range.
///
Task CountByRangeAsync(
string tenantId,
HlcTimestamp? startT,
HlcTimestamp? endT,
CancellationToken ct = default);
}