package addons

import (
	"os"
	"path/filepath"
)

const (
	addonMarkerDir = "/opt/zlh/.zlh/addons"
)

func IsAddonProvisioned(name string) bool {
	path := filepath.Join(addonMarkerDir, name)
	_, err := os.Stat(path)
	return err == nil
}

func WriteAddonMarker(name string) error {
	if err := os.MkdirAll(addonMarkerDir, 0755); err != nil {
		return err
	}
	path := filepath.Join(addonMarkerDir, name)
	return os.WriteFile(path, []byte("ok"), 0644)
}
