package view

// GENERATED. DO NOT EDIT.

{{- if $.Imports }}

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

func NewHandler(handler *viewrt.Handler) *Handler {
	return &Handler{handler}
}

type Handler struct {
	handler *viewrt.Handler
}

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

func (h *Handler) Renderer(route string, props interface{}) http.Handler {
	return h.handler.Renderer(route, props)
}

type FS = fs.FS

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