// Code generated - EDITING IS FUTILE. DO NOT EDIT.
//
// Generated by:
//     kinds/gen.go
// Using jennies:
//     CoreRegistryJenny
//
// Run 'make gen-cue' from repository root to regenerate.

package schemas

import (
	"os"
	"path/filepath"
	"runtime"

	"cuelang.org/go/cue"
	"cuelang.org/go/cue/cuecontext"
)

type CoreKind struct {
	Name    string
	CueFile cue.Value
}

func GetCoreKinds() ([]CoreKind, error) {
	ctx := cuecontext.New()
	kinds := make([]CoreKind, 0)

	_, caller, _, _ := runtime.Caller(0)
	root := filepath.Join(caller, "../../../..")

	dashboardCue, err := loadCueFile(ctx, filepath.Join(root, "./kinds/dashboard/dashboard_kind.cue"))
	if err != nil {
		return nil, err
	}
	kinds = append(kinds, CoreKind{
		Name:    "dashboard",
		CueFile: dashboardCue,
	})

	return kinds, nil
}

func loadCueFile(ctx *cue.Context, path string) (cue.Value, error) {
	cueFile, err := os.ReadFile(path)
	if err != nil {
		return cue.Value{}, err
	}

	return ctx.CompileBytes(cueFile), nil
}
