namespace CashLineERP.Application.Integration;

public interface IInboxMessageRepository
{
    IReadOnlyCollection<InboxMessageDetailView> GetInboxMessages(string? statusCode = null, string? integrationProviderCode = null);

    InboxMessageDetailView? GetInboxMessage(long inboxMessageId);

    InboxMessageDetailView? FindExistingMessage(long integrationEndpointId, string? externalMessageId, string? correlationKey);

    IReadOnlyCollection<InboxMessageDetailView> GetPendingMessages(int batchSize, string? integrationProviderCode = null, IReadOnlyCollection<string>? excludedIntegrationProviderCodes = null);

    InboxMessageDetailView Receive(ReceiveInboxMessageCommand command);

    ProcessInboxBatchResultView ProcessPendingMessages(ProcessInboxBatchCommand command);

    InboxMessageDetailView MarkProcessed(long inboxMessageId, string processorCode);

    InboxMessageDetailView ScheduleRetry(long inboxMessageId, string errorText, int delaySeconds);

    InboxMessageDetailView MarkFailed(long inboxMessageId, string errorText);

    InboxMessageDetailView MoveToDeadLetter(long inboxMessageId, long actorUserId, string reasonText);

    InboxMessageDetailView Replay(long inboxMessageId, long actorUserId, string replayReasonText, int delaySeconds);
}
