// 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: 600 bytes.
var cuegenInstanceData = []byte("\x01\x1f\x8b\b\x00\x00\x00\x00\x00\x00\xff\x94R\xdfo\xd3:\x18\xb5\xd3^\xe9\xd6\u06bd\x12\x7f\x00\u0487\x9fZ4\xd2\x1f\x12<D\v\xb0\x8d\x81\xf6\xb0\xb50@\b\u0103\x97|M\xad\xb9vH\x9c\xb1\n6`\x8c\xfd\xd9\vr\x9al\x85\xb7\xe5%G_r\xbes||\xfe+\x7fy\xd4+/\t-\xbf\x13\xf2\xe8[\x8b\xd25\xa9s+t\x84\u03c4\x15nL[\xb4\xfd\xca\x18K=B\xdb\x13agt\x8d\xd0\x7f\x9eK\x859-/\b!w\u02df\x1e\xa5\xff\x7f\xf8\x18\x15\xe8O\xa5\xaa\x99\x17\x84\x96\xe7\x84t\xcb\x1f-J\xff\xbd\x99\x9f\x13\xea\xd1\xf6\xbe\x98\xa3[\u052e\x86\x8c\x10r\xd5zY^\x12\x8fR\xba\x1e\x15\xa8\x84N|\x93%\xfd\xc4\xf4QG&\x96\xda\xe1\xc8\xc4\u0637\x98\xdbXX\xd1O\x8f\x92!\xa5\xf4\x8e{\xf7\x1b\xdf~T \xbd\xf2\u07a7\":\x12\t\x82\xfb\u0218\x9c\xa7&\xb3\xd0e\x1d~\x8b\xed#\xce:<\xb7\x99\xd4I\xee\xe0\\\xd8\x19g=\xc6\xf6\x16\a6+\"\x1b\xc0\x17\xd6\xd9\f\x006\xc2\xe1\x80u\xb6\x02\x80\xf0\x8cG\xc2r\xf8\n\xf7yl\x12\xce:\xe3'\x01\x8c\xed\f\xb3%\x87uv\x03p\xb6F\xfen\xe5j\x0f\xd9)<MLw=2\xf3T\xa1\xc5p\xbb\x06=\xb6Bl\xc4jC\xfe\xb6\xd1VH\x9do\xeaE\x97\xbf\xe3=\u0599\x04\u02fd\x13\x19\x1d\xb9\xad\xec\xa0\xfa5\x80\xfa\xb9\x17r\xde\xe0J\xf0X(\x19\v\x8b\xe1\xd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