// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
{% if not for_bindings_internals -%}
import {mojo} from '{{bindings_library_path}}';
{%- endif %}
{% for path, kinds in js_module_imports.items()|sort -%}
import {
{%- for kind in kinds|sort %}
{%- for item in kind|imports_for_kind %}
{{item.name}} as {{item.alias}}
{%- if not loop.last -%},{% endif -%}
{%- endfor %}
{%- if not loop.last -%},{% endif -%}
{%- endfor %}
} from '{{path}}';
{% endfor -%}
{%- if typemapped_structs|length > 0 %}
{%- for struct in typemapped_structs.keys() %}
import {
{{struct.name}}DataView,
{{struct.name}}TypeMapper,
} from './{{converters_filename}}';
{%- endfor %}
{%- endif %}
{% for typemap in typemapped_structs.values() -%}
import { {{typemap.converter}} } from './{{typemap.converter_import}}';
{% endfor -%}
{#--- Constants #}
{%- for constant in module.constants %}
export const {{constant.name}}: {{constant.kind|ts_type_maybe_nullable}} = {{constant|constant_value}};
{% endfor -%}
{#--- Enums #}
{%- from "enum_definition.tmpl" import enum_def with context %}
{%- for enum in enums %}
{{enum_def(enum)}}
{% endfor -%}
{#--- Interfaces #}
{%- for interface in interfaces %}
{% include "interface_definition.tmpl" %}
{%- endfor %}
{#--- Struct and Union forward declarations #}
{% for struct in structs %}
export const {{struct.name}}Spec: { $: mojo.internal.MojomType } =
{ $: {} as unknown as mojo.internal.MojomType };
{% endfor %}
{%- for union in unions %}
export const {{union.name}}Spec: { $: mojo.internal.MojomType } =
{ $: {} as unknown as mojo.internal.MojomType };
{% endfor %}
{#--- Struct definitions #}
{% for struct in structs %}
{%- include "struct_definition.tmpl" %}
{% endfor -%}
{#--- Union definitions #}
{% for union in unions %}
{%- include "union_definition.tmpl" %}
{% endfor %}