<?php

declare(strict_types=1);

namespace PhpWA\Storage;

interface AccountTransactionInterface
{
    public function get(string $collection, string $key): ?StoredValue;

     
    public function list(string $collection, int $limit = 1000): array;

     
    public function put(string $collection, string $key, string $value, ?int $expectedRevision = null): StoredValue;

     
    public function delete(string $collection, string $key, ?int $expectedRevision = null): void;

    public function hasIncoming(string $messageId): bool;

    



    public function stageIncoming(string $messageId, string $eventType, string $jsonPayload, int $receivedAt): bool;

     
    public function claimOutbox(string $leaseOwner, int $limit, int $now, int $leaseSeconds): array;

    public function completeOutbox(string $eventId, string $leaseOwner): void;

    public function releaseOutbox(string $eventId, string $leaseOwner, int $availableAt): void;

     
    public function hasPendingOutbox(): bool;

    public function registerRetry(string $messageId, int $now, int $maximumAttempts = 5, int $baseDelaySeconds = 2): RetryDecision;

    public function clearRetry(string $messageId): void;

     
    public function prune(int $dedupeBefore, int $retryBefore): void;
}
