// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

{%  for declaration in module.namespace|namespace_declarations -%}
/** @const */
{%-   if loop.first %}
var {{declaration}} = {};
{%    else %}
{{declaration}} = {};
{%    endif -%}
{%- endfor -%}

{#--- Constant definitions #}
{%- for constant in module.constants %}
/** @type { {{constant.kind|closure_type_with_nullability }} } */
{{module.namespace}}.{{constant.name}};
{%- endfor %}

{#--- Enum definitions #}
{% for enum in enums %}
/** @enum {number} */
{{module.namespace}}.{{enum.name}} = {};
{%-   for field in enum.fields %}
{{module.namespace}}.{{enum.name}}.{{field.name}};
{%-   endfor %}
{%- endfor %}

{#--- Interface definitions #}
{%- for interface in interfaces -%}
{%-   include "externs/interface_definition.tmpl" %}
{%  endfor -%}

{#--- Struct definitions #}
{%- for struct in structs -%}
{%-   include "externs/struct_definition.tmpl" %}
{%  endfor -%}
