package public

// GENERATED. DO NOT EDIT.

{{- if $.Imports }}

import (
	{{- range $import := $.Imports }}
	{{$import.Name}} "{{$import.Path}}"
	{{- end }}
)
{{- end }}

func Load(handler publicrt.Handler) *Handler {
	return &Handler{handler}
}

type Handler struct {
	handler http.Handler
}

func (h *Handler) Register(r *router.Router) {
	{{- range $file := $.Files }}
	r.Get(`{{ $file.Route }}`, h.handler)
	{{- end }}
}

func LoadFS() FS {
	return virtual.Map{
		{{- range $file := $.Files }}
		{{- if $file.Data }}
		"{{ $file.Path }}": &virtual.File{
			Path: "{{ $file.Path }}",
			{{/* Using double quotes matters because $file.Data is escaped hex */}}
			Data: []byte("{{ $file.Data }}"),
		},
		{{ end }}
		{{- end }}
	}
}

type FS = fs.FS
