// 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_, cuegenValue = func() (*gocodec.Codec, *cue.Instance, cue.Value) {
	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], instances[0].Value()
}()

// Deprecated: cue.Instance is deprecated. Use cuegenValue instead.
var cuegenInstance = cuegenInstance_

// cuegenMake is called in the init phase to initialize CUE values for
// validation functions.
func cuegenMake(name string, x interface{}) cue.Value {
	f, err := cuegenValue.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: 605 bytes.
var cuegenInstanceData = []byte("\x01\x1f\x8b\b\x00\x00\x00\x00\x00\x00\xff\x94RMo\xd3J\x14\x9dq\xf2\xa4\u7afe'\xbd\x1f\xf0\xa4\u02ec\x12T\xec$\x12,\xac\x1a\xfaAA]\xb4\x89hA\b\xc4bb\xdf8\xa3:3&\x1e\x97F\xd0\x02\xa5\xf4g\xd7\u020e\u04d6\x05\x8bzut\xeds\xcf\xf1\xb9\xe7\x9f\xf2\xa7\u00dd\xf2\x8a\xf1\xf2\x1bcO\xbe\xb68_S:\xb7RG\xf4\\ZY\x8dy\x8b\xb7_\x19c\xb9\xc3x{$\ud52f1\xfe\xd7\v\x95R\xce\xcbK\xc6\xd8\xff\xe5\x0f\x87\xf3\x7f\xdf\x7f\x88\n\xf2&*m\x98\x97\x8c\x97\x17\x8cu\xca\xef-\xce\xff\xbe\x9d_0\xee\xf0\xf6\x81\x9cQ\xb5\xa8]\x0f\x811v\xdd:*\xaf\x98\xc39\xf7\xa3\x82R\xa9\x13\xcf\xcc\x13?1>\xe9\xc8\xc4JW821\xf9\x96r\x1bK+\xfd\xec8\xe9o\x9e\xf48\xe7\xffU\xd0_Y\xf7\xa2\x82\xf8\xb5\xf3.\x93\u0471L\b\xab\x97\x00j\x96\x99\xb9\xc5\x0e\xb8\xe2\x1e\x02\x03\x01\xae\xc8\xed\\\xe9$\xaf\xe0L\u06a9\x80.\xc0\xfe\xe2\xd0\u038b\xc8\x06\xf8\x19\u072d\x00q#\xec\xf7\xc0\xdd\x0e\x10\xc3s\x11I+\xf0\v>\x14\xb1I\x04\xb8\xc3g\x01\x0e\xed\x94\xe6K\x0e\xb8{\x01V\xb6\x06\xde^\xedj\x9f\xe0\f7\x13\xd3Y\x8f\xcc,K\xc9R\xb8\u04c0.\xdc!\xae\xc4\x1aC\u078e\xd1V*\x9do\xe9EG\xbc\x15]pG\xc1r\xefHE\xc7\xd5V8\xac?\r\xb0y\x1e\x84B\xacp-x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