package batch_quote_processor_v2

import (
	"fmt"
	"strings"
)

func deriveItemIdempotencyKey(base string, previewOnly bool, index int, total int) string {
	if previewOnly {
		return ""
	}
	base = strings.TrimSpace(base)
	if base == "" {
		return ""
	}
	if total <= 1 {
		return base
	}
	return fmt.Sprintf("%s:%d", base, index+1)
}
