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

namespace StellaOps.Scanner.Worker.Processing;

public interface IScanJobLease : IAsyncDisposable
{
    string JobId { get; }

    string ScanId { get; }

    int Attempt { get; }

    DateTimeOffset EnqueuedAtUtc { get; }

    DateTimeOffset LeasedAtUtc { get; }

    TimeSpan LeaseDuration { get; }

    IReadOnlyDictionary<string, string> Metadata { get; }

    ValueTask RenewAsync(CancellationToken cancellationToken);

    ValueTask CompleteAsync(CancellationToken cancellationToken);

    ValueTask AbandonAsync(string reason, CancellationToken cancellationToken);

    ValueTask PoisonAsync(string reason, CancellationToken cancellationToken);
}
