// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT

{{- if .DeclarationReferences }} 
{{range .DeclarationReferences}}
const {{.}} = require('./_{{.}}');{{end}}{{- end}}

{{- range $struct := .Structs }} 
{{- if .IsUsedAsData }}

/**
{{if .Comments }}{{range .Comments}} *{{ . }}{{end}}{{end}}
 * @typedef {object} {{.Name}}
{{- range .Fields}}{{- if not .JSONOptions.Ignored }}
 * @property {{"{"}}{{.TypeForPropertyDoc}}{{"}"}} {{.NameForPropertyDoc}} {{- if .Comments}} - {{- range .Comments}}{{ . }}{{- end}}{{- end}}{{- end}}
{{- end}}
 */
export var {{.Name}};

{{- end}}
{{- if .IsBound }}
{{- if .Methods }}

{{if .Comments }}{{range .Comments}}// {{ . }}{{end}}{{end}}
export const {{.Name}} = {
{{range .Methods }}
  /**{{if .Comments }}
{{range .Comments}}    * {{ . }}{{end}}
    *{{end}}
    * @function {{.Name}}
{{range .Inputs}}    * @param {{"{"}}{{.JSType}}{{"}"}} {{.Name}}
{{end}}    *
    * @returns {Promise<{{.OutputsAsTSText $.Name}}>} 
    */
  {{.Name}}: function({{.InputsAsJSText}}) {
    return window.backend.{{$.Name}}.{{$struct.Name}}.{{.Name}}({{.InputsAsJSText}});
  },
{{end}}
}

{{- end}}
{{- end}}
{{- end}}
