package benchmarks

import (
	"testing"

	"github.com/jfraeys/fetch_ml/internal/queue"
)

// BenchmarkNativeQueueBasic tests basic native queue operations
func BenchmarkNativeQueueBasic(b *testing.B) {
	tmpDir := b.TempDir()

	// Only run if native libs available
	if !queue.UseNativeQueue {
		b.Skip("Native queue not enabled (build with -tags native_libs)")
	}

	q, err := queue.NewNativeQueue(tmpDir)
	if err != nil {
		b.Fatal(err)
	}
	defer q.Close()

	// Test single add
	task := &queue.Task{
		ID:       "test-1",
		JobName:  "test-job",
		Priority: 100,
	}

	b.ReportAllocs()

	for i := 0; b.Loop(); i++ {
		task.ID = "test-" + string(rune('0'+i%10))
		if err := q.AddTask(task); err != nil {
			b.Fatal(err)
		}
	}
}
