namespace CashLineERP.Application.Tax;

public interface IEtaComplianceRepository
{
    EtaPayloadPreviewView? GetPayloadPreview(long accountsReceivableInvoiceId);

    EtaSubmissionValidationPackView? GetSubmissionValidationPack(long accountsReceivableInvoiceId);

    IReadOnlyCollection<EtaSubmissionLogView> GetSubmissionLogs(long accountsReceivableInvoiceId);

    IReadOnlyCollection<EtaDocumentEventView> GetDocumentEvents(long accountsReceivableInvoiceId);

    EtaSubmissionLogView SubmitInvoice(long accountsReceivableInvoiceId, long actorUserId, string? payloadText);

    EtaSubmissionLogView ResubmitRejectedInvoice(
        long accountsReceivableInvoiceId,
        long rejectedEtaSubmissionLogId,
        long actorUserId,
        string? payloadText,
        string? correctionNotes);

    EtaSubmissionLogView RecordInvoiceResponse(
        long accountsReceivableInvoiceId,
        long etaSubmissionLogId,
        long actorUserId,
        string statusCode,
        string? etaUuid,
        string? responseText,
        string? errorCode,
        string? errorMessage,
        string? notesText);

    IReadOnlyCollection<EtaTransmissionAttemptView> GetTransmissions(long accountsReceivableInvoiceId);

    EtaTransmissionAttemptView? GetTransmission(long etaTransmissionAttemptId);

    IReadOnlyCollection<EtaTransmissionAttemptView> GetPendingAuthorityStatusPollBatch(int batchSize);

    EtaTransmissionAttemptView? FindPendingTransmissionByCorrelation(string correlationKey);

    EtaTransmissionAttemptView QueueTransmission(long accountsReceivableInvoiceId, long etaSubmissionLogId, long actorUserId);

    DispatchEtaTransmissionBatchResultView DispatchQueuedTransmissions(DispatchEtaTransmissionBatchCommand command);

    PollEtaTransmissionBatchResultView PollDispatchedTransmissions(PollEtaTransmissionBatchCommand command);

    EtaTransmissionAttemptView MarkTransmissionAccepted(long etaTransmissionAttemptId, long actorUserId, string processorCode, string etaUuid, string? responseText);

    EtaTransmissionAttemptView MarkTransmissionRejected(long etaTransmissionAttemptId, long actorUserId, string processorCode, string errorText, string? responseText, string? errorCode);

    EtaTransmissionAttemptView FailTransmission(long etaTransmissionAttemptId, long actorUserId, string errorText, string? responseText);

    EtaTransmissionAttemptView RetryTransmission(long etaTransmissionAttemptId, RetryEtaTransmissionCommand command);
}
