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

//line templates/typescript/resource.qtpl:1
package typescript

//line templates/typescript/resource.qtpl:1
import "github.com/apibrew/apibrew/pkg/model"

//line templates/typescript/resource.qtpl:3
import (
	qtio422016 "io"

	qt422016 "github.com/valyala/quicktemplate"
)

//line templates/typescript/resource.qtpl:3
var (
	_ = qtio422016.Copy
	_ = qt422016.AcquireByteBuffer
)

//line templates/typescript/resource.qtpl:3
func StreamGenerateClassCode(qw422016 *qt422016.Writer, pkg string, resource *model.Resource) {
//line templates/typescript/resource.qtpl:4
	for _, reference := range getAllReferencedResources(resource) {
//line templates/typescript/resource.qtpl:4
		qw422016.N().S(`import {`)
//line templates/typescript/resource.qtpl:5
		qw422016.N().S(typescriptClassName(reference.Resource))
//line templates/typescript/resource.qtpl:5
		qw422016.N().S(`} from './`)
//line templates/typescript/resource.qtpl:5
		qw422016.N().S(fileName(reference.Resource))
//line templates/typescript/resource.qtpl:5
		qw422016.N().S(`';
`)
//line templates/typescript/resource.qtpl:6
	}
//line templates/typescript/resource.qtpl:6
	qw422016.N().S(`
export interface `)
//line templates/typescript/resource.qtpl:8
	qw422016.E().S(typescriptClassName(resource.Name))
//line templates/typescript/resource.qtpl:8
	qw422016.N().S(` {
`)
//line templates/typescript/resource.qtpl:9
	for _, property := range resource.Properties {
//line templates/typescript/resource.qtpl:9
		qw422016.N().S(`    `)
//line templates/typescript/resource.qtpl:10
		qw422016.N().S(propertyName(property))
//line templates/typescript/resource.qtpl:10
		if !property.Required {
//line templates/typescript/resource.qtpl:10
			qw422016.N().S(`?`)
//line templates/typescript/resource.qtpl:10
		}
//line templates/typescript/resource.qtpl:10
		qw422016.N().S(`: `)
//line templates/typescript/resource.qtpl:10
		qw422016.N().S(getTypescriptType(resource, property, false))
//line templates/typescript/resource.qtpl:10
		qw422016.N().S(`
`)
//line templates/typescript/resource.qtpl:11
	}
//line templates/typescript/resource.qtpl:11
	qw422016.N().S(`}

export const `)
//line templates/typescript/resource.qtpl:14
	qw422016.E().S(typescriptClassName(resource.Name))
//line templates/typescript/resource.qtpl:14
	qw422016.N().S(`EntityInfo = {
    namespace: "`)
//line templates/typescript/resource.qtpl:15
	qw422016.E().S(resource.Namespace)
//line templates/typescript/resource.qtpl:15
	qw422016.N().S(`",
    resource: "`)
//line templates/typescript/resource.qtpl:16
	qw422016.E().S(resource.Name)
//line templates/typescript/resource.qtpl:16
	qw422016.N().S(`",
    restPath: "`)
//line templates/typescript/resource.qtpl:17
	qw422016.E().S(getRestPath(resource))
//line templates/typescript/resource.qtpl:17
	qw422016.N().S(`",
}
`)
//line templates/typescript/resource.qtpl:19
	for _, subType := range getAllSubTypes(resource) {
//line templates/typescript/resource.qtpl:19
		qw422016.N().S(`
export interface `)
//line templates/typescript/resource.qtpl:21
		qw422016.E().S(typescriptClassName(subType.Name))
//line templates/typescript/resource.qtpl:21
		qw422016.N().S(` {
`)
//line templates/typescript/resource.qtpl:22
		for _, property := range subType.Properties {
//line templates/typescript/resource.qtpl:22
			qw422016.N().S(`    `)
//line templates/typescript/resource.qtpl:23
			qw422016.N().S(propertyName(property))
//line templates/typescript/resource.qtpl:23
			qw422016.N().S(`: `)
//line templates/typescript/resource.qtpl:23
			qw422016.N().S(getTypescriptType(resource, property, false))
//line templates/typescript/resource.qtpl:23
			qw422016.N().S(`
`)
//line templates/typescript/resource.qtpl:24
		}
//line templates/typescript/resource.qtpl:24
		qw422016.N().S(`}
`)
//line templates/typescript/resource.qtpl:26
	}
//line templates/typescript/resource.qtpl:27
	for _, enum := range getAllEnums(resource) {
//line templates/typescript/resource.qtpl:27
		qw422016.N().S(`
export enum `)
//line templates/typescript/resource.qtpl:29
		qw422016.E().S(typescriptClassName(enum.Name))
//line templates/typescript/resource.qtpl:29
		qw422016.N().S(` {
`)
//line templates/typescript/resource.qtpl:30
		for _, enumValue := range enum.EnumValues {
//line templates/typescript/resource.qtpl:30
			qw422016.N().S(`    `)
//line templates/typescript/resource.qtpl:31
			qw422016.N().S(enumName(enumValue))
//line templates/typescript/resource.qtpl:31
			qw422016.N().S(` = "`)
//line templates/typescript/resource.qtpl:31
			qw422016.E().S(enumValue)
//line templates/typescript/resource.qtpl:31
			qw422016.N().S(`",
`)
//line templates/typescript/resource.qtpl:32
		}
//line templates/typescript/resource.qtpl:32
		qw422016.N().S(`}
`)
//line templates/typescript/resource.qtpl:34
	}
//line templates/typescript/resource.qtpl:34
	qw422016.N().S(`
export const `)
//line templates/typescript/resource.qtpl:36
	qw422016.E().S(typescriptClassName(resource.Name))
//line templates/typescript/resource.qtpl:36
	qw422016.N().S(`Resource = `)
//line templates/typescript/resource.qtpl:36
	qw422016.N().S(resourceJson(resource))
//line templates/typescript/resource.qtpl:36
	qw422016.N().S(` as unknown

`)
//line templates/typescript/resource.qtpl:38
}

//line templates/typescript/resource.qtpl:38
func WriteGenerateClassCode(qq422016 qtio422016.Writer, pkg string, resource *model.Resource) {
//line templates/typescript/resource.qtpl:38
	qw422016 := qt422016.AcquireWriter(qq422016)
//line templates/typescript/resource.qtpl:38
	StreamGenerateClassCode(qw422016, pkg, resource)
//line templates/typescript/resource.qtpl:38
	qt422016.ReleaseWriter(qw422016)
//line templates/typescript/resource.qtpl:38
}

//line templates/typescript/resource.qtpl:38
func GenerateClassCode(pkg string, resource *model.Resource) string {
//line templates/typescript/resource.qtpl:38
	qb422016 := qt422016.AcquireByteBuffer()
//line templates/typescript/resource.qtpl:38
	WriteGenerateClassCode(qb422016, pkg, resource)
//line templates/typescript/resource.qtpl:38
	qs422016 := string(qb422016.B)
//line templates/typescript/resource.qtpl:38
	qt422016.ReleaseByteBuffer(qb422016)
//line templates/typescript/resource.qtpl:38
	return qs422016
//line templates/typescript/resource.qtpl:38
}
