package claimpolicy

import "time"

// StaleProcessingSeconds bounds how long a connector event may remain in
// 'processing' before ClaimNext may reclaim it. Drain-only startup eligibility
// is broader and stays alive for any non-terminal row, including fresh
// processing rows already claimed by the worker.
const StaleProcessingSeconds = 300

// FailureRetryDelay is the shared genuine-failure backoff policy for the
// WorkItem authority path and the bounded legacy Event fallback.
func FailureRetryDelay(failureCount int) time.Duration {
	switch {
	case failureCount <= 1:
		return 5 * time.Second
	case failureCount == 2:
		return 30 * time.Second
	case failureCount == 3:
		return 2 * time.Minute
	case failureCount == 4:
		return 5 * time.Minute
	default:
		return 15 * time.Minute
	}
}
