{% extends "admin/admin_base.html" %}

{% block admin_content %}
<link rel="stylesheet" href="{{ url_for('static', filename='swagger/swagger-ui.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='css/api-explorer.css') }}">
<div class="api-explorer-wrap" role="region" data-i18n-attr="aria-label:explorer.aria.region">
  <header class="api-explorer-header">
    <h1 class="api-explorer-title" data-i18n="explorer.title">API Explorer</h1>
    <p class="api-explorer-hint" data-i18n="explorer.hint">Try it out использует вашу сессию админки и CSRF для mutating запросов.</p>
  </header>

  <div class="api-explorer-controls">
    <div class="api-explorer-tabs" role="tablist" data-i18n-attr="aria-label:explorer.aria.scope">
      <button type="button" class="api-explorer-tab active" data-scope="admin" role="tab" aria-selected="true" data-i18n="explorer.tab.admin">Admin API</button>
      <button type="button" class="api-explorer-tab" data-scope="public" role="tab" aria-selected="false" data-i18n="explorer.tab.public">Public API</button>
    </div>
    <div class="api-explorer-sources" role="group" data-i18n-attr="aria-label:explorer.aria.source">
      <button type="button" class="api-explorer-chip active" data-source="all" data-i18n="explorer.source.all">Все</button>
      <button type="button" class="api-explorer-chip" data-source="core" data-i18n="explorer.source.core">Ядро</button>
      <button type="button" class="api-explorer-chip" data-source="module" data-i18n="explorer.source.module">Модуль</button>
      <button type="button" class="api-explorer-chip" data-source="plugin" data-i18n="explorer.source.plugin">Плагин</button>
      <button type="button" class="api-explorer-chip" data-source="service" data-i18n="explorer.source.service">Сервис</button>
    </div>
    <div class="api-explorer-actions">
      <button type="button" class="btn btn-sm btn-outline-secondary" id="api-explorer-download-json">JSON</button>
      <button type="button" class="btn btn-sm btn-outline-secondary" id="api-explorer-download-yaml">YAML</button>
    </div>
  </div>

  <div class="api-explorer-banner api-explorer-banner--public" id="api-explorer-public-banner" hidden data-i18n="explorer.banner.public">
  Внешний API — не используйте для административных операций. Полная версия в админке.
  </div>

  <div class="api-explorer-loading" id="api-explorer-loading" hidden>
    <div class="api-explorer-skeleton"></div>
  </div>
  <div class="api-explorer-empty" id="api-explorer-empty" hidden data-i18n="explorer.empty">
    Нет доступных endpoint'ов для вашей роли или фильтра.
  </div>

  <div id="swagger-ui" class="api-explorer-swagger"></div>
</div>
{% endblock %}

{% block admin_scripts %}
<script src="{{ url_for('static', filename='swagger/swagger-ui-bundle.js') }}"></script>
<script src="{{ url_for('static', filename='swagger/swagger-ui-standalone-preset.js') }}"></script>
<script src="{{ url_for('static', filename='js/admin-api-explorer.js') }}"></script>
{% endblock %}
