//go:build cgo && !native_libs
// +build cgo,!native_libs

package worker

import (
	"errors"
	"log"

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

func init() {
	log.Printf("[native] Native libraries disabled (build with -tags native_libs to enable)")
}

// HashFilesBatchNative is not available without native_libs build tag.
func HashFilesBatchNative(paths []string) ([]string, error) {
	return nil, errors.New("native batch hash requires native_libs build tag")
}

// GetSIMDImplName returns "disabled" when native libs aren't built.
func GetSIMDImplName() string {
	return "disabled"
}

// HasSIMDSHA256 returns false when native libs aren't built.
func HasSIMDSHA256() bool {
	return false
}

// ScanArtifactsNative is disabled without native_libs build tag.
func ScanArtifactsNative(runDir string) (*manifest.Artifacts, error) {
	return nil, errors.New("native artifact scanner requires native_libs build tag")
}

// ExtractTarGzNative is disabled without native_libs build tag.
func ExtractTarGzNative(archivePath, dstDir string) error {
	return errors.New("native tar.gz extractor requires native_libs build tag")
}

// QueueIndexNative is a stub type when native libs aren't built.
type QueueIndexNative struct{}

// OpenQueueIndexNative is not available without native_libs build tag.
func OpenQueueIndexNative(queueDir string) (*QueueIndexNative, error) {
	return nil, errors.New("native queue index requires native_libs build tag")
}

// Close is a no-op for the stub.
func (qi *QueueIndexNative) Close() {}

// AddTasks is not available without native_libs build tag.
func (qi *QueueIndexNative) AddTasks(tasks []*queue.Task) error {
	return errors.New("native queue index requires native_libs build tag")
}

// DirOverallSHA256HexNative is disabled without native_libs build tag.
func DirOverallSHA256HexNative(root string) (string, error) {
	return "", errors.New("native hash requires native_libs build tag")
}
