{{- .FilePrefix}}
// Code generated by pkg/config/schema/codegen/tools/collections.main.go. DO NOT EDIT.

package {{.PackageName}}

import (
	"istio.io/istio/pkg/config/schema/collection"
	"istio.io/istio/pkg/config/schema/resource"
	"istio.io/istio/pkg/config/validation"
{{ .CustomImport }}
  "reflect"
{{- range .Packages}}
	{{.ImportName}} "{{.PackageName}}"
{{- end}}
)

var (
{{ range .Entries }}
	{{ .Resource.Identifier }} = resource.Builder {
			Identifier: "{{ .Resource.Identifier }}",
			Group: "{{ .Resource.Group }}",
			Kind: "{{ .Resource.Kind }}",
			Plural: "{{ .Resource.Plural }}",
			Version: "{{ .Resource.Version }}",
			{{- if .Resource.VersionAliases }}
            VersionAliases: []string{
				{{- range $alias := .Resource.VersionAliases}}
			        "{{$alias}}",
		 	    {{- end}}
			},
			{{- end}}
			Proto: "{{ .Resource.Proto }}",
			{{- if ne .Resource.StatusProto "" }}StatusProto: "{{ .Resource.StatusProto }}",{{end}}
			ReflectType: reflect.TypeOf(&{{.ClientImport}}.{{.SpecType}}{}).Elem(),
			{{- if ne .StatusType "" }}StatusType: reflect.TypeOf(&{{.StatusImport}}.{{.StatusType}}{}).Elem(), {{end}}
			ProtoPackage: "{{ .Resource.ProtoPackage }}",
			{{- if ne "" .Resource.StatusProtoPackage}}StatusPackage: "{{ .Resource.StatusProtoPackage }}", {{end}}
			ClusterScoped: {{ .Resource.ClusterScoped }},
			Synthetic: {{ .Resource.Synthetic }},
			Builtin: {{ .Resource.Builtin }},
			ValidateProto: {{ .Resource.Validate }},
		}.MustBuild()
{{ end }}

	// All contains all collections in the system.
	All = collection.NewSchemasBuilder().
	{{- range .Entries }}
		MustAdd({{ .Resource.Identifier }}).
	{{- end }}
		Build()

	// Kube contains only kubernetes collections.
	Kube = collection.NewSchemasBuilder().
	{{- range .Entries }}
		{{- if or (contains .Resource.Group "k8s.io") .Resource.Builtin  }}
		MustAdd({{ .Resource.Identifier }}).
		{{- end }}
	{{- end }}
		Build()

	// Pilot contains only collections used by Pilot.
	Pilot = collection.NewSchemasBuilder().
	{{- range .Entries }}
		{{- if (contains .Resource.Group "istio.io") }}
		MustAdd({{ .Resource.Identifier }}).
		{{- end}}
	{{- end }}
		Build()

	// pilotGatewayAPI contains only collections used by Pilot, including the full Gateway API.
	pilotGatewayAPI = collection.NewSchemasBuilder().
	{{- range .Entries }}
		{{- if or (contains .Resource.Group "istio.io") (contains .Resource.Group "gateway.networking.k8s.io") (contains .Resource.Group "gateway.networking.x-k8s.io") }}
		MustAdd({{ .Resource.Identifier }}).
		{{- end}}
	{{- end }}
		Build()

	// PilotStableGatewayAPI contains only collections used by Pilot, including beta+ Gateway API.
	pilotStableGatewayAPI = collection.NewSchemasBuilder().
	{{- range .Entries }}
		{{- if or
       (contains .Resource.Group "istio.io")
       (and
          (contains .Resource.Group "gateway.networking.k8s.io")
          (not (contains .Resource.Version "alpha")))
    }}
		MustAdd({{ .Resource.Identifier }}).
		{{- end}}
	{{- end }}
		Build()
)
