package runner

import (
	"testing"

	"github.com/easyai/easyai-ai-gateway/apps/api/internal/clients"
)

func TestTimeoutDoesNotBecomeUpstreamSubmissionUnknown(t *testing.T) {
	timeoutErr := &clients.ClientError{Code: "timeout", Message: "upstream request timed out", Retryable: false}
	if shouldEnterSubmissionConfirmationPending(false, "submitting", timeoutErr) {
		t.Fatal("a definitive provider timeout must remain timeout instead of manual-review unknown")
	}
	networkErr := &clients.ClientError{Code: "network", Message: "connection reset", Retryable: true}
	if !shouldEnterSubmissionConfirmationPending(false, "submitting", networkErr) {
		t.Fatal("an ambiguous non-timeout disconnect must retain manual-review protection")
	}
}
