// Code generated by gocode.Generate; DO NOT EDIT.

package pkg1

import (
	"fmt"

	"cuelang.org/go/cue"
	"cuelang.org/go/encoding/gocode/gocodec"
	_ "cuelang.org/go/pkg"
)

var cuegenvalMyStruct = cuegenMake("MyStruct", &MyStruct{})

// Validate validates x.
func (x *MyStruct) Validate() error {
	return cuegenCodec.Validate(cuegenvalMyStruct, x)
}

// Complete completes x.
func (x *MyStruct) Complete() error {
	return cuegenCodec.Complete(cuegenvalMyStruct, x)
}

var cuegenvalOtherStruct = cuegenMake("OtherStruct", &OtherStruct{})

// Validate validates x.
func (x *OtherStruct) Validate() error {
	return cuegenCodec.Validate(cuegenvalOtherStruct, x)
}

var cuegenvalString = cuegenMake("String", nil)

// ValidateCUE validates x.
func (x String) ValidateCUE() error {
	return cuegenCodec.Validate(cuegenvalString, x)
}

var cuegenvalSpecialString = cuegenMake("SpecialString", nil)

// ValidateSpecialString validates x.
func ValidateSpecialString(x string) error {
	return cuegenCodec.Validate(cuegenvalSpecialString, x)
}

var cuegenvalPtr = cuegenMake("Ptr", Ptr(nil))

// ValidatePtr validates x.
func ValidatePtr(x Ptr) error {
	return cuegenCodec.Validate(cuegenvalPtr, x)
}

var cuegenCodec, cuegenInstance = func() (*gocodec.Codec, *cue.Instance) {
	var r *cue.Runtime
	r = &cue.Runtime{}
	instances, err := r.Unmarshal(cuegenInstanceData)
	if err != nil {
		panic(err)
	}
	if len(instances) != 1 {
		panic("expected encoding of exactly one instance")
	}
	return gocodec.New(r, nil), instances[0]
}()

// cuegenMake is called in the init phase to initialize CUE values for
// validation functions.
func cuegenMake(name string, x interface{}) cue.Value {
	f, err := cuegenInstance.Value().FieldByName(name, true)
	if err != nil {
		panic(fmt.Errorf("could not find type %q in instance", name))
	}
	v := f.Value
	if x != nil {
		w, err := cuegenCodec.ExtractType(x)
		if err != nil {
			panic(err)
		}
		v = v.Unify(w)
	}
	return v
}

// Data size: 601 bytes.
var cuegenInstanceData = []byte("\x01\x1f\x8b\b\x00\x00\x00\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