{% extends "documentation/base.tera" %}

{% block title %}{{ i18n.labels.title_server_reference }}{% endblock title %}

{% block toc %}
## {{ i18n.labels.table_of_contents }}

{% if doc.routes %}
- [{{ i18n.labels.routes }}](#routes)
{% for route in doc.routes %}
  - [{{ route.path }}](#{{ route.anchor }})
{% endfor %}
{% endif %}

{% if doc.components %}
- [{{ i18n.labels.components }}](#components)
{% for component in doc.components %}
  - [{{ component.name }}](#{{ component.anchor }})
{% endfor %}
{% endif %}

{% if doc.pages %}
- [{{ i18n.labels.pages }}](#pages)
{% for page in doc.pages %}
  - [{{ page.path }}](#{{ page.anchor }})
{% endfor %}
{% endif %}

{% endblock toc %}

{% block content %}

{% if doc.routes %}
## {{ i18n.labels.routes }} {% raw %}{#routes}{% endraw %}

{% for route in doc.routes %}
### {{ route.path }} {% raw %}{#{% endraw %}{{ route.anchor }}{% raw %}}{% endraw %}}

{% if route.src_ref %}
{% include "partials/source_link.tera" %}
{% endif %}

**{{ i18n.labels.methods }}:** {% for method in route.methods %}`{{ method }}`{% if not loop.last %}, {% endif %}{% endfor %}

**{{ i18n.labels.handler }}:** `{{ route.handler }}`

**{{ i18n.labels.module }}:** `{{ route.module }}`

**{{ i18n.labels.response_type }}:** {{ route.response_type }}

**{{ i18n.labels.requires_auth }}:** {{ route.requires_auth }}

{% if route.middleware %}
**{{ i18n.labels.middleware }}:** {% for mw in route.middleware %}`{{ mw }}`{% if not loop.last %}, {% endif %}{% endfor %}
{% endif %}

{% if route.parameters %}
**{{ i18n.labels.parameters }}:**

| Name | Type | Source | Optional |
|---|---|---|---|
{% for param in route.parameters %}
| `{{ param.name }}` | `{{ param.param_type }}` | {{ param.source }} | {{ param.optional }} |
{% endfor %}
{% endif %}

{% if route.description %}
**{{ i18n.labels.description }}:** {{ route.description }}
{% endif %}

---

{% endfor %}
{% endif %}

{% if doc.components %}
## {{ i18n.labels.components }} {% raw %}{#components}{% endraw %}

{% for component in doc.components %}
{% include "partials/component_card.tera" %}
{% endfor %}
{% endif %}

{% if doc.pages %}
## {{ i18n.labels.pages }} {% raw %}{#pages}{% endraw %}

{% for page in doc.pages %}
#### {{ page.path }} {% raw %}{#{% endraw %}{{ page.anchor }}{% raw %}}{% endraw %}}

{% if page.src_ref %}
{% include "partials/source_link.tera" %}
{% endif %}

**Component:** `{{ page.component }}`

**Page Component:** `{{ page.page_component }}`

**Unified Component:** `{{ page.unified_component }}`

{% if page.module_path %}
**{{ i18n.labels.module }}:** `{{ page.module_path }}`
{% endif %}

**{{ i18n.labels.enabled }}:** {{ page.enabled }}

**{{ i18n.labels.priority }}:** {{ page.priority }}

{% if page.requires_auth is defined %}
**{{ i18n.labels.requires_auth }}:** {{ page.requires_auth }}
{% endif %}

{% if page.menu_group %}
**Menu Group:** {{ page.menu_group }}
{% endif %}

{% if page.keywords %}
**{{ i18n.labels.keywords }}:** {{ page.keywords | join(sep=", ") }}
{% endif %}

---

{% endfor %}
{% endif %}

{% endblock content %}
