//
// Code generated by grafana-app-sdk. DO NOT EDIT.
//

package v1

import (
	"errors"

	"github.com/grafana/grafana-app-sdk/resource"
)

// schema is unexported to prevent accidental overwrites
var (
	schemaTestKind = resource.NewSimpleSchema("testapp.ext.grafana.app", "v1", NewTestKind(), &TestKindList{}, resource.WithKind("TestKind"),
		resource.WithPlural("testkinds"), resource.WithScope(resource.NamespacedScope), resource.WithSelectableFields([]resource.SelectableField{resource.SelectableField{
			FieldSelector: ".spec.stringField",
			FieldValueFunc: func(o resource.Object) (string, error) {
				cast, ok := o.(*TestKind)
				if !ok {
					return "", errors.New("provided object must be of type *TestKind")
				}

				return string(cast.Spec.StringField), nil
			},
		},
		}))
	kindTestKind = resource.Kind{
		Schema: schemaTestKind,
		Codecs: map[resource.KindEncoding]resource.Codec{
			resource.KindEncodingJSON: &TestKindJSONCodec{},
		},
	}
)

// Kind returns a resource.Kind for this Schema with a JSON codec
func TestKindKind() resource.Kind {
	return kindTestKind
}

// Schema returns a resource.SimpleSchema representation of TestKind
func TestKindSchema() *resource.SimpleSchema {
	return schemaTestKind
}

// Interface compliance checks
var _ resource.Schema = kindTestKind
