using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;

namespace StellaOps.Scanner.Queue;

public interface IScanQueueLease
{
    string MessageId { get; }

    string JobId { get; }

    ReadOnlyMemory<byte> Payload { get; }

    int Attempt { get; }

    DateTimeOffset EnqueuedAt { get; }

    DateTimeOffset LeaseExpiresAt { get; }

    string Consumer { get; }

    string? IdempotencyKey { get; }

    IReadOnlyDictionary<string, string> Attributes { get; }

    Task AcknowledgeAsync(CancellationToken cancellationToken = default);

    Task RenewAsync(TimeSpan leaseDuration, CancellationToken cancellationToken = default);

    Task ReleaseAsync(QueueReleaseDisposition disposition, CancellationToken cancellationToken = default);

    Task DeadLetterAsync(string reason, CancellationToken cancellationToken = default);
}
