// Code generated by qtc from "resource-def.qtpl". DO NOT EDIT.
// See https://github.com/valyala/quicktemplate for details.

//line templates/java/resource-def.qtpl:1
package java

//line templates/java/resource-def.qtpl:1
import "github.com/apibrew/apibrew/pkg/model"

//line templates/java/resource-def.qtpl:2
import "google.golang.org/protobuf/types/known/structpb"

//line templates/java/resource-def.qtpl:4
import (
	qtio422016 "io"

	qt422016 "github.com/valyala/quicktemplate"
)

//line templates/java/resource-def.qtpl:4
var (
	_ = qtio422016.Copy
	_ = qt422016.AcquireByteBuffer
)

//line templates/java/resource-def.qtpl:4
func StreamGenerateStructDef(qw422016 *qt422016.Writer, value *structpb.Value) {
//line templates/java/resource-def.qtpl:6
	if value == nil {
//line templates/java/resource-def.qtpl:6
		qw422016.N().S(`nil `)
//line templates/java/resource-def.qtpl:8
	} else if value.GetStringValue() != "" {
//line templates/java/resource-def.qtpl:8
		qw422016.N().S(`structpb.NewStringValue("`)
//line templates/java/resource-def.qtpl:9
		qw422016.E().S(value.GetStringValue())
//line templates/java/resource-def.qtpl:9
		qw422016.N().S(`") `)
//line templates/java/resource-def.qtpl:10
	} else if value.GetNumberValue() != 0 {
//line templates/java/resource-def.qtpl:10
		qw422016.N().S(`structpb.NewNumberValue(`)
//line templates/java/resource-def.qtpl:11
		qw422016.N().F(value.GetNumberValue())
//line templates/java/resource-def.qtpl:11
		qw422016.N().S(`) `)
//line templates/java/resource-def.qtpl:12
	} else if value.GetBoolValue() != false {
//line templates/java/resource-def.qtpl:12
		qw422016.N().S(`structpb.NewBoolValue(`)
//line templates/java/resource-def.qtpl:13
		if value.GetBoolValue() {
//line templates/java/resource-def.qtpl:13
			qw422016.N().S(`true`)
//line templates/java/resource-def.qtpl:13
		} else {
//line templates/java/resource-def.qtpl:13
			qw422016.N().S(`false`)
//line templates/java/resource-def.qtpl:13
		}
//line templates/java/resource-def.qtpl:13
		qw422016.N().S(`) `)
//line templates/java/resource-def.qtpl:14
	} else if value.GetListValue() != nil {
//line templates/java/resource-def.qtpl:14
		qw422016.N().S(`structpb.NewListValue(&structpb.ListValue{ Values: []*structpb.Value{ `)
//line templates/java/resource-def.qtpl:17
		for _, item := range value.GetListValue().Values {
//line templates/java/resource-def.qtpl:18
			StreamGenerateStructDef(qw422016, item)
//line templates/java/resource-def.qtpl:18
			qw422016.N().S(`, `)
//line templates/java/resource-def.qtpl:19
		}
//line templates/java/resource-def.qtpl:19
		qw422016.N().S(`}, }) `)
//line templates/java/resource-def.qtpl:22
	} else if value.GetStructValue() != nil {
//line templates/java/resource-def.qtpl:22
		qw422016.N().S(`structpb.NewStructValue(&structpb.Struct{ Fields: map[string]*structpb.Value{ `)
//line templates/java/resource-def.qtpl:25
		for key, item := range value.GetStructValue().Fields {
//line templates/java/resource-def.qtpl:25
			qw422016.N().S(`"`)
//line templates/java/resource-def.qtpl:26
			qw422016.E().S(key)
//line templates/java/resource-def.qtpl:26
			qw422016.N().S(`":`)
//line templates/java/resource-def.qtpl:26
			StreamGenerateStructDef(qw422016, item)
//line templates/java/resource-def.qtpl:26
			qw422016.N().S(`, `)
//line templates/java/resource-def.qtpl:27
		}
//line templates/java/resource-def.qtpl:27
		qw422016.N().S(`}, }) `)
//line templates/java/resource-def.qtpl:30
	} else if value.GetNullValue() != 0 {
//line templates/java/resource-def.qtpl:30
		qw422016.N().S(`nil `)
//line templates/java/resource-def.qtpl:32
	} else {
//line templates/java/resource-def.qtpl:32
		qw422016.N().S(`nil `)
//line templates/java/resource-def.qtpl:34
	}
//line templates/java/resource-def.qtpl:36
}

//line templates/java/resource-def.qtpl:36
func WriteGenerateStructDef(qq422016 qtio422016.Writer, value *structpb.Value) {
//line templates/java/resource-def.qtpl:36
	qw422016 := qt422016.AcquireWriter(qq422016)
//line templates/java/resource-def.qtpl:36
	StreamGenerateStructDef(qw422016, value)
//line templates/java/resource-def.qtpl:36
	qt422016.ReleaseWriter(qw422016)
//line templates/java/resource-def.qtpl:36
}

//line templates/java/resource-def.qtpl:36
func GenerateStructDef(value *structpb.Value) string {
//line templates/java/resource-def.qtpl:36
	qb422016 := qt422016.AcquireByteBuffer()
//line templates/java/resource-def.qtpl:36
	WriteGenerateStructDef(qb422016, value)
//line templates/java/resource-def.qtpl:36
	qs422016 := string(qb422016.B)
//line templates/java/resource-def.qtpl:36
	qt422016.ReleaseByteBuffer(qb422016)
//line templates/java/resource-def.qtpl:36
	return qs422016
//line templates/java/resource-def.qtpl:36
}

//line templates/java/resource-def.qtpl:38
func StreamGeneratePropertyDef(qw422016 *qt422016.Writer, resource *model.Resource, property *model.ResourceProperty) {
//line templates/java/resource-def.qtpl:38
	qw422016.N().S(`{
        Name:     "`)
//line templates/java/resource-def.qtpl:39
	qw422016.E().S(property.Name)
//line templates/java/resource-def.qtpl:39
	qw422016.N().S(`",
        Type:     model.ResourceProperty_`)
//line templates/java/resource-def.qtpl:40
	qw422016.E().S(property.Type.String())
//line templates/java/resource-def.qtpl:40
	qw422016.N().S(`,
`)
//line templates/java/resource-def.qtpl:41
	if property.Length > 0 {
//line templates/java/resource-def.qtpl:41
		qw422016.N().S(`Length:   `)
//line templates/java/resource-def.qtpl:41
		qw422016.N().D(int(property.Length))
//line templates/java/resource-def.qtpl:41
		qw422016.N().S(`,
        `)
//line templates/java/resource-def.qtpl:42
	}
//line templates/java/resource-def.qtpl:43
	if property.Required {
//line templates/java/resource-def.qtpl:43
		qw422016.N().S(`Required: true,
        `)
//line templates/java/resource-def.qtpl:44
	}
//line templates/java/resource-def.qtpl:45
	if property.Unique {
//line templates/java/resource-def.qtpl:45
		qw422016.N().S(`Unique: true,
        `)
//line templates/java/resource-def.qtpl:46
	}
//line templates/java/resource-def.qtpl:47
	if property.Immutable {
//line templates/java/resource-def.qtpl:47
		qw422016.N().S(`Immutable: true,
        `)
//line templates/java/resource-def.qtpl:48
	}
//line templates/java/resource-def.qtpl:49
	if property.DefaultValue != nil {
//line templates/java/resource-def.qtpl:49
		qw422016.N().S(`DefaultValue:`)
//line templates/java/resource-def.qtpl:49
		StreamGenerateStructDef(qw422016, property.DefaultValue)
//line templates/java/resource-def.qtpl:49
		qw422016.N().S(`,
        `)
//line templates/java/resource-def.qtpl:50
	}
//line templates/java/resource-def.qtpl:51
	if property.ExampleValue != nil {
//line templates/java/resource-def.qtpl:51
		qw422016.N().S(`ExampleValue:`)
//line templates/java/resource-def.qtpl:51
		StreamGenerateStructDef(qw422016, property.ExampleValue)
//line templates/java/resource-def.qtpl:51
		qw422016.N().S(`,
        `)
//line templates/java/resource-def.qtpl:52
	}
//line templates/java/resource-def.qtpl:52
	qw422016.N().S(`        `)
//line templates/java/resource-def.qtpl:53
	StreamGenerateAnnotationsDef(qw422016, property.Annotations)
//line templates/java/resource-def.qtpl:53
	qw422016.N().S(`
    }`)
//line templates/java/resource-def.qtpl:54
}

//line templates/java/resource-def.qtpl:54
func WriteGeneratePropertyDef(qq422016 qtio422016.Writer, resource *model.Resource, property *model.ResourceProperty) {
//line templates/java/resource-def.qtpl:54
	qw422016 := qt422016.AcquireWriter(qq422016)
//line templates/java/resource-def.qtpl:54
	StreamGeneratePropertyDef(qw422016, resource, property)
//line templates/java/resource-def.qtpl:54
	qt422016.ReleaseWriter(qw422016)
//line templates/java/resource-def.qtpl:54
}

//line templates/java/resource-def.qtpl:54
func GeneratePropertyDef(resource *model.Resource, property *model.ResourceProperty) string {
//line templates/java/resource-def.qtpl:54
	qb422016 := qt422016.AcquireByteBuffer()
//line templates/java/resource-def.qtpl:54
	WriteGeneratePropertyDef(qb422016, resource, property)
//line templates/java/resource-def.qtpl:54
	qs422016 := string(qb422016.B)
//line templates/java/resource-def.qtpl:54
	qt422016.ReleaseByteBuffer(qb422016)
//line templates/java/resource-def.qtpl:54
	return qs422016
//line templates/java/resource-def.qtpl:54
}

//line templates/java/resource-def.qtpl:56
func StreamGenerateAnnotationsDef(qw422016 *qt422016.Writer, annotations map[string]string) {
//line templates/java/resource-def.qtpl:56
	qw422016.N().S(`
`)
//line templates/java/resource-def.qtpl:57
	if len(annotations) > 0 {
//line templates/java/resource-def.qtpl:57
		qw422016.N().S(`        Annotations: map[string]string{
`)
//line templates/java/resource-def.qtpl:59
		for key, value := range annotations {
//line templates/java/resource-def.qtpl:59
			qw422016.N().S(`			"`)
//line templates/java/resource-def.qtpl:60
			qw422016.E().S(key)
//line templates/java/resource-def.qtpl:60
			qw422016.N().S(`": "`)
//line templates/java/resource-def.qtpl:60
			qw422016.E().S(value)
//line templates/java/resource-def.qtpl:60
			qw422016.N().S(`",
`)
//line templates/java/resource-def.qtpl:61
		}
//line templates/java/resource-def.qtpl:61
		qw422016.N().S(`	    },
	    `)
//line templates/java/resource-def.qtpl:63
	}
//line templates/java/resource-def.qtpl:63
	qw422016.N().S(`
`)
//line templates/java/resource-def.qtpl:64
}

//line templates/java/resource-def.qtpl:64
func WriteGenerateAnnotationsDef(qq422016 qtio422016.Writer, annotations map[string]string) {
//line templates/java/resource-def.qtpl:64
	qw422016 := qt422016.AcquireWriter(qq422016)
//line templates/java/resource-def.qtpl:64
	StreamGenerateAnnotationsDef(qw422016, annotations)
//line templates/java/resource-def.qtpl:64
	qt422016.ReleaseWriter(qw422016)
//line templates/java/resource-def.qtpl:64
}

//line templates/java/resource-def.qtpl:64
func GenerateAnnotationsDef(annotations map[string]string) string {
//line templates/java/resource-def.qtpl:64
	qb422016 := qt422016.AcquireByteBuffer()
//line templates/java/resource-def.qtpl:64
	WriteGenerateAnnotationsDef(qb422016, annotations)
//line templates/java/resource-def.qtpl:64
	qs422016 := string(qb422016.B)
//line templates/java/resource-def.qtpl:64
	qt422016.ReleaseByteBuffer(qb422016)
//line templates/java/resource-def.qtpl:64
	return qs422016
//line templates/java/resource-def.qtpl:64
}

//line templates/java/resource-def.qtpl:66
func StreamGenerateResourceDefCode(qw422016 *qt422016.Writer, resource *model.Resource) {
//line templates/java/resource-def.qtpl:67
	qw422016.N().S(`new Resource() .withName("`)
//line templates/java/resource-def.qtpl:69
	qw422016.E().S(resource.Name)
//line templates/java/resource-def.qtpl:69
	qw422016.N().S(`") .withNamespace(new Namespace().withName(`)
//line templates/java/resource-def.qtpl:70
	qw422016.E().S(resource.Namespace)
//line templates/java/resource-def.qtpl:70
	qw422016.N().S(`)) `)
//line templates/java/resource-def.qtpl:71
	if resource.Title != nil {
//line templates/java/resource-def.qtpl:71
		qw422016.N().S(`.withTitle("`)
//line templates/java/resource-def.qtpl:71
		qw422016.E().S(*resource.Title)
//line templates/java/resource-def.qtpl:71
		qw422016.N().S(`")`)
//line templates/java/resource-def.qtpl:71
	}
//line templates/java/resource-def.qtpl:71
	qw422016.N().S(` `)
//line templates/java/resource-def.qtpl:72
	if resource.Description != nil {
//line templates/java/resource-def.qtpl:72
		qw422016.N().S(`.withDescription("`)
//line templates/java/resource-def.qtpl:72
		qw422016.E().S(*resource.Description)
//line templates/java/resource-def.qtpl:72
		qw422016.N().S(`")`)
//line templates/java/resource-def.qtpl:72
	}
//line templates/java/resource-def.qtpl:72
	qw422016.N().S(` `)
//line templates/java/resource-def.qtpl:73
	if len(resource.Types) > 0 {
//line templates/java/resource-def.qtpl:73
		qw422016.N().S(`.withSubTypes( `)
//line templates/java/resource-def.qtpl:75
		for _, typ := range resource.Types {
//line templates/java/resource-def.qtpl:75
			qw422016.N().S(`new ResourceSubType() .withName("`)
//line templates/java/resource-def.qtpl:77
			qw422016.E().S(typ.Name)
//line templates/java/resource-def.qtpl:77
			qw422016.N().S(`") `)
//line templates/java/resource-def.qtpl:78
			if typ.Title != "" {
//line templates/java/resource-def.qtpl:78
				qw422016.N().S(`.withTitle("`)
//line templates/java/resource-def.qtpl:78
				qw422016.E().S(typ.Title)
//line templates/java/resource-def.qtpl:78
				qw422016.N().S(`") `)
//line templates/java/resource-def.qtpl:79
			}
//line templates/java/resource-def.qtpl:80
			if typ.Description != "" {
//line templates/java/resource-def.qtpl:80
				qw422016.N().S(`.withDescription("`)
//line templates/java/resource-def.qtpl:80
				qw422016.E().S(typ.Description)
//line templates/java/resource-def.qtpl:80
				qw422016.N().S(`") `)
//line templates/java/resource-def.qtpl:81
			}
//line templates/java/resource-def.qtpl:81
			qw422016.N().S(`.withProperties( `)
//line templates/java/resource-def.qtpl:83
			for _, property := range typ.Properties {
//line templates/java/resource-def.qtpl:84
				StreamGeneratePropertyDef(qw422016, resource, property)
//line templates/java/resource-def.qtpl:84
				qw422016.N().S(`, `)
//line templates/java/resource-def.qtpl:85
			}
//line templates/java/resource-def.qtpl:85
			qw422016.N().S(`) `)
//line templates/java/resource-def.qtpl:87
			StreamGenerateAnnotationsDef(qw422016, typ.Annotations)
//line templates/java/resource-def.qtpl:87
			qw422016.N().S(`) `)
//line templates/java/resource-def.qtpl:89
		}
//line templates/java/resource-def.qtpl:89
		qw422016.N().S(`) `)
//line templates/java/resource-def.qtpl:91
	}
//line templates/java/resource-def.qtpl:91
	qw422016.N().S(`.withProperties( `)
//line templates/java/resource-def.qtpl:93
	for _, property := range resource.Properties {
//line templates/java/resource-def.qtpl:94
		StreamGeneratePropertyDef(qw422016, resource, property)
//line templates/java/resource-def.qtpl:94
		qw422016.N().S(`, `)
//line templates/java/resource-def.qtpl:95
	}
//line templates/java/resource-def.qtpl:95
	qw422016.N().S(`) `)
//line templates/java/resource-def.qtpl:97
	if len(resource.Indexes) > 0 {
//line templates/java/resource-def.qtpl:97
		qw422016.N().S(`.withIndexes( `)
//line templates/java/resource-def.qtpl:99
		for _, index := range resource.Indexes {
//line templates/java/resource-def.qtpl:99
			qw422016.N().S(`new ResourceIndex() .withUnique(`)
//line templates/java/resource-def.qtpl:101
			if index.Unique {
//line templates/java/resource-def.qtpl:101
				qw422016.N().S(`true`)
//line templates/java/resource-def.qtpl:101
			} else {
//line templates/java/resource-def.qtpl:101
				qw422016.N().S(`false`)
//line templates/java/resource-def.qtpl:101
			}
//line templates/java/resource-def.qtpl:101
			qw422016.N().S(`) .withProperties( `)
//line templates/java/resource-def.qtpl:103
			for _, property := range index.Properties {
//line templates/java/resource-def.qtpl:103
				qw422016.N().S(`new ResourceIndexProperty() .withName("`)
//line templates/java/resource-def.qtpl:105
				qw422016.E().S(property.Name)
//line templates/java/resource-def.qtpl:105
				qw422016.N().S(`") .withOrder(model.ResourceIndexProperty_`)
//line templates/java/resource-def.qtpl:106
				qw422016.E().S(property.Order.String())
//line templates/java/resource-def.qtpl:106
				qw422016.N().S(`), `)
//line templates/java/resource-def.qtpl:107
			}
//line templates/java/resource-def.qtpl:107
			qw422016.N().S(`) `)
//line templates/java/resource-def.qtpl:109
			StreamGenerateAnnotationsDef(qw422016, index.Annotations)
//line templates/java/resource-def.qtpl:109
			qw422016.N().S(`) `)
//line templates/java/resource-def.qtpl:111
		}
//line templates/java/resource-def.qtpl:111
		qw422016.N().S(`) `)
//line templates/java/resource-def.qtpl:113
	}
//line templates/java/resource-def.qtpl:114
	if resource.Virtual {
//line templates/java/resource-def.qtpl:114
		qw422016.N().S(`.withVirtual(true), `)
//line templates/java/resource-def.qtpl:115
	}
//line templates/java/resource-def.qtpl:116
	if resource.Immutable {
//line templates/java/resource-def.qtpl:116
		qw422016.N().S(`.withImmutable(true), `)
//line templates/java/resource-def.qtpl:117
	}
//line templates/java/resource-def.qtpl:118
	if resource.Abstract {
//line templates/java/resource-def.qtpl:118
		qw422016.N().S(`.withAbstract(true), `)
//line templates/java/resource-def.qtpl:119
	}
//line templates/java/resource-def.qtpl:120
	if resource.CheckReferences {
//line templates/java/resource-def.qtpl:120
		qw422016.N().S(`.withCheckReferences(true), `)
//line templates/java/resource-def.qtpl:121
	}
//line templates/java/resource-def.qtpl:122
	StreamGenerateAnnotationsDef(qw422016, resource.Annotations)
//line templates/java/resource-def.qtpl:122
	qw422016.N().S(` } `)
//line templates/java/resource-def.qtpl:125
}

//line templates/java/resource-def.qtpl:125
func WriteGenerateResourceDefCode(qq422016 qtio422016.Writer, resource *model.Resource) {
//line templates/java/resource-def.qtpl:125
	qw422016 := qt422016.AcquireWriter(qq422016)
//line templates/java/resource-def.qtpl:125
	StreamGenerateResourceDefCode(qw422016, resource)
//line templates/java/resource-def.qtpl:125
	qt422016.ReleaseWriter(qw422016)
//line templates/java/resource-def.qtpl:125
}

//line templates/java/resource-def.qtpl:125
func GenerateResourceDefCode(resource *model.Resource) string {
//line templates/java/resource-def.qtpl:125
	qb422016 := qt422016.AcquireByteBuffer()
//line templates/java/resource-def.qtpl:125
	WriteGenerateResourceDefCode(qb422016, resource)
//line templates/java/resource-def.qtpl:125
	qs422016 := string(qb422016.B)
//line templates/java/resource-def.qtpl:125
	qt422016.ReleaseByteBuffer(qb422016)
//line templates/java/resource-def.qtpl:125
	return qs422016
//line templates/java/resource-def.qtpl:125
}
