// 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: 603 bytes.
var cuegenInstanceData = []byte("\x01\x1f\x8b\b\x00\x00\x00\x00\x00\x00\xff\x94RMo\xd3J\x14\x9dq\xf2\xa4\x97Q\u07d3\xde\x0fx\xd2eV\t*v\x12\t\x16V\r\xfd\xa0\xa0.\xdaD\xb4 \x04b1\xb5o\x9cQ'3&\x1e\x97F\xd0\x02\xa5\xf4g\xd7h\x1c\xbb\r\xec\x9a\xd5\u044d\xcf=g\xce=\xff\x94?=\xea\x95\u05c4\x96\xdf\by\xf2\xb5E\xe9\x9a\u0539\x15:\xc6\xe7\xc2\n7\xa6-\xda~e\x8c\xa5\x1e\xa1\xed\xb1\xb0S\xbaF\xe8_/\xa4\u009c\x96W\x84\x90\xff\xcb\x1f\x1e\xa5\xff\xbe\xff\x10\x17\xe8O\xa4\xaa\x99W\x84\x96\x97\x84t\xcb\xef-J\xff\xbe\x9b_\x12\xea\xd1\xf6\x81\x98\xa1[\u052e\x86\x8c\x10r\xd3:*\xaf\x89G)\r\xe2\x02\x95\u0429o\xe6i\x90\x9a\x00ul\x12\xa9\x1d\x8eM\x82\x81\xc5\xdc&\u008a ;I\a\x9b\xa7}J\xe9\x7f\x0e\x06\x8du?.\x90\xdex\xef2\x11\x9f\x88\x14\xc1\xfd\u0258\x9cefn\xa1\xcb:\xfc\x1e\x02C\xce:<\xb7s\xa9\xd3\xdc\xc1\x99\xb0S\xcez\x8c\xed/\x0e\xed\xbc\x88m\b\x9fYg+\x04\u0608\x06}\xd6\xd9\x0e\x01\xa2\v\x1e\v\xcb\xe1\v<\xe4\x89I9\ub31e\x850\xb2S\x9c/9\xac\xb3\x17\x82\xb35\xf4\xf7*W\xfb\xc8\xcea35\xdd\xf5\xd8\xcc2\x85\x16\xa3\x9d\x1a\xf4\xd8\n\xb1\x11\xab\r\xf9;F[!u\xbe\xa5\x17]\xfe\x96\xf7Xg\x1c.\xf7\x8ee|\u2db2\xc3\xea\xd3\x10\xea\u07c3\x88\xf3\x06W\x82\xa7B\xc9DX\x8c\xde\xd4`\xe7\xf5n\x8f\x1df\x18K\xa1\x1art\xc1\xf3\xe5\x84/Yv\x91a\xb4t\xd1c{\xa96s<\x9a\u02bc\x92\x89.\xf8\xc4\x18\xceF3iou\x01\xa4\xb6\x15\xf7Q\x8f\xb1 \x80\x03\xa3w\xcfdn\xa5N\xe1\x93T\n\x8e\x11\xccLZ\x8b\t\x88\x1c\u071b\x11d\x0e\xda\x00~,\xe4\xa9P\xa8-\xbc4\xe0\xa4}\xb6B\xafB\xd9nB\xa9\x83\xacUde\r\n\x8dg.gL\xa0\xd0\n\xf3\x1c\xf0,S2\x96V-\x00\xb58V\x98\xf8lbL\xe8l\xb2\xb1\x9d7I\xbb{\xfb\xfb\x85\xb22S8\x9at\a\xfd\x1e;g\x84x\xeb\xf7)Q]\xd1\xe1\xef\x15\x15+\x05\x1d\xde\x16\xf4\xaem\xac)Gcfc\xd0\xef\xaf<\xf5\x8f\xfb\x8b\xe3\x98;s\xcb\u04c7\xf0\xf41#\xe4W\x00\x00\x00\xff\xff{\xa57\xb4\xe3\x03\x00\x00")
