{% extends "base.html" %}

{% block title %}{{ namespace.name }}.{{ enum.name }}{% endblock %}

{% block meta_other %}
  <meta property="og:title" content="{{ namespace.name }}.{{ enum.name }}"/>
  <meta property="og:description" content="Reference for {{ namespace.name }}.{{ enum.name }}"/>
  <meta name="twitter:title" content="{{ namespace.name }}.{{ enum.name }}"/>
  <meta name="twitter:description" content="Reference for {{ namespace.name }}.{{ enum.name }}"/>
{% endblock %}

{% macro sidebar_block(elements, enum_name, section_title, section_class, section_fragment) -%}
{% if elements|length > 0 %}
<div class="section">
  <h5>{{ section_title }}</h5>
  <div class="links">
  {% for m in elements %}
    <a class="{{ section_class }}" href="{{ section_fragment }}.{{ enum_name }}.{{ m.name }}.html">{{ m.name }}</a>
  {% endfor %}
  </div>
</div>
{% endif %}
{% endmacro %}

{% block sidebar %}
<div class="section">
  <h5>Type</h5>
  <div class="links">
    <a class="current" href="{{ enum.link_prefix }}.{{ enum.name }}.html">{{ enum.name }}</a>
  </div>
</div>

{{ sidebar_block(enum.type_funcs, enum.name, "Type functions", "func", "type_func") }}
{% endblock %}

{% macro navbar_block(attribute, section_title, section_link) -%}
{% if attribute %}
<li class="toc-list-item"><a href="{{ section_link }}"><span class="link-text">{{ section_title }}</span></a></li>
{% endif %}
{% endmacro %}

{% block navbar %}
<div id="toc" class="toc">
  <nav aria-labelledby="toc-title">
    <p id="toc-title">Content</p>
    <ul class="toc-list">
      <li class="toc-list-item"><a href="#description"><span class="link-text">Description</span></a></li>
      <li class="toc-list-item"><a href="#members"><span class="link-text">Members</span></a></li>
      {{ navbar_block(enum.error_domain, "Error domain", "#error-domain") }}
      {{ navbar_block(enum.type_funcs, "Functions", "#type-functions") }}
    </ul>
  </nav>
</div>
{% endblock %}

{% block content %}
<section id="main" class="content">
  <header>
    <h3>Enumeration</h3>
    <h1><a href="index.html">{{ namespace.name }}</a><span class="sep"></span>{{ enum.name }}</h1>
  </header>

  <section>
    <div class="docblock">
      <p>
      {%- if CONFIG.is_unstable(enum.available_since) -%}
      <span class="emblem available-next" title="This type will be available in the next stable release">unstable</span>&nbsp;
      {%- endif %}
      {%- if enum.deprecated_since -%}
      <span class="emblem deprecated">deprecated: {{ enum.deprecated_since.version }}</span>&nbsp;
      {%- endif -%}
      {%- if enum.available_since -%}
      <span class="emblem available">since: {{ enum.available_since }}</span>
      {%- endif -%}
      </p>
    </div>

    <div class="declaration toggle-wrapper">
      <h4 style="display:flex;" id="declaration">
        Declaration
        <a href="#declaration" class="anchor"></a>
        {% if CONFIG.source_location_url and enum.source_location %}
        <a class="srclink" title="go to source location" href="{{ CONFIG.source_link(enum.source_location) }}">[src]</a>
        {% endif %}
      </h4>

      <div class="docblock">
        <pre><code>{{ enum.c_decl }}</code></pre>
      </div>
    </div>

    <div class="description toggle-wrapper">
      <h4 style="display:flex;" id="description">
        Description
        <a href="#description" class="anchor"></a>
        {% if CONFIG.source_location_url and enum.docs_location %}
        <a class="srclink" title="go to source location" href="{{ CONFIG.source_link(enum.docs_location) }}">[src]</a>
        {% endif %}
      </h4>

      <div class="docblock">
      {{ enum.description }}
      </div>

      <div class="docblock">
        {% if enum.stability %}
        <p>Stability: {{ enum.stability }}</p>
        {% endif %}
        {% if enum.available_since %}
        <p>Available since: {{ enum.available_since }}</p>
        {% endif %}
        {% if enum.deprecated_since %}
        <div class="admonition deprecation">
          <p class="admonition-title">Deprecated since: {{ enum.deprecated_since.version }}</p>
          {%- if enum.deprecated_since.message -%}
          {{ enum.deprecated_since.message }}
          {%- else -%}
          <p>Do not use in newly written code.</p>
          {%- endif -%}
        </div>
        {% endif %}
      </div>

      {% if enum.attributes %}
      <div class="docblock">
        <table class="attributes">
        {% for (key, value) in enum.attributes.items()|sort %}
          <tr><td>{{ key|escape }}</td><td>{{ value|escape }}</td></tr>
        {% endfor %}
        </table>
      </div>
      {% endif %}
    </div>

    <div class="members toggle-wrapper">
      <h4 id="members">
        Members
        <a href="#members" class="anchor"></a>
      </h4>

      <div class="docblock">
        <dl class="enum-members">
        {% for member in enum.members %}
          <dt>
            <code id="{{ member.girname }}">{{ member.name }}</code>
            <a class="anchor" href="#{{ member.girname }}"></a>
          </dt>
          <dd>
            <div>{{ member.description }}</div>
            <ul>
              <li>Value: <code>{{ member.value }}</code></li>
              {% if enum.nick -%}
              <li>Nickname: <code>{{ member.nick }}</code></li>
              {%- endif %}
              {% if member.available_since -%}
              <li>Available since: {{ member.available_since }}</li>
              {%- else -%}
              <li>Available since: {{ namespace.version }}</li>
              {%- endif %}
            </ul>
          </dd>
        {% endfor %}
        </dl>
      </div>
    </div>

    {% if enum.error_domain %}
    <div class="error-domain toggle-wrapper">
      <h4 id="error-domain">
        Error domain
        <a href="#error-domain" class="anchor"></a>
      </h4>

      <div class="docblock">
        <pre><code>&quot;{{ enum.domain }}&quot;</code></pre>
      </div>
    </div>
    {% endif %}

    {% if enum.type_funcs %}
    <div class="type-funcs toggle-wrapper">
      <h4 id="type-functions">
        Type functions
        <a href="#type-functions" class="anchor"></a>
      </h4>

      <div class="docblock">
      {% for func in enum.type_funcs %}
        <div class="{% if func.deprecated_since %}deprecated{% endif %}">
          <h6><a href="type_func.{{ enum.name }}.{{ func.name }}.html">{{ func.identifier }}</a></h6>
          <div class="docblock">
            {{ func.summary }}
          </div>
          <div class="docblock">
            <p>
            {%- if CONFIG.is_unstable(func.available_since) -%}
            <span class="emblem available-next" title="This function will be available in the next stable release">unstable</span>&nbsp;
            {%- endif %}
            {%- if func.deprecated_since -%}
            <span class="emblem deprecated">deprecated: {{ func.deprecated_since }}</span>&nbsp;
            {%- endif -%}
            {%- if func.available_since -%}
            <span class="emblem available">since: {{ func.available_since }}</span>
            {%- endif -%}
            </p>
          </div>
        </div>
      {% endfor %}
    </div>
    {% endif %}

  </section>
</section>
{% endblock %}
