<!DOCTYPE html>
<html lang="pt-BR">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Operações da API (Swagger) – Plataforma de Integrações Aegro</title>
    <style>
      * { box-sizing: border-box; }
      body { margin: 0; font-family: system-ui, -apple-system, sans-serif; }
      .layout { display: flex; min-height: 100vh; }
      .sidebar {
        width: 240px; min-width: 240px; padding: 1.25rem 1rem;
        position: sticky; top: 0; height: 100vh; overflow-y: auto;
        border-right: 1px solid #e0e0e0; background: #fafafa;
      }
      .sidebar-nav { margin-bottom: 1.25rem; }
      .sidebar-nav a { display: block; padding: 0.4rem 0; color: #00be5e; text-decoration: none; font-weight: 500; }
      .sidebar-nav a:hover { text-decoration: underline; }
      .sidebar-nav a.active { color: #008f47; font-weight: 600; }
      .toc-title { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: #666; margin: 0.75rem 0 0.5rem; }
      .toc { font-size: 0.9rem; }
      .toc a { display: block; padding: 0.25rem 0; color: #444; text-decoration: none; }
      .toc a:hover { color: #00be5e; }
      .swagger-main { flex: 1; min-width: 0; }
      @media (max-width: 768px) {
        .layout { flex-direction: column; }
        .sidebar { width: 100%; height: auto; position: relative; border-right: none; border-bottom: 1px solid #e0e0e0; }
      }
    </style>
    <link rel="stylesheet" type="text/css" href="/docs/public-api/static/swagger-ui.css" />
    <link rel="stylesheet" type="text/css" href="/docs/public-api/static/index.css" />
    <link rel="stylesheet" type="text/css" href="/docs/public-api/static/swagger-custom.css" />
    <link rel="icon" type="image/png" href="https://app.aegro.com.br/images/favicon.png"/>
  </head>
  <body>
    <div class="layout">
      <aside class="sidebar">
        <nav class="sidebar-nav" aria-label="Documentação">
          <a href="/docs/public-api/">Introdução</a>
          <a href="/docs/public-api/model.html">Modelo de dados</a>
          <a href="/docs/public-api/swagger.html" class="active">Operações da API (Swagger)</a>
        </nav>
        <div class="toc-title">Nesta página</div>
        <nav class="toc" id="swagger-toc" aria-label="Seções da API"></nav>
      </aside>
      <div class="swagger-main">
        <div id="swagger-ui"></div>
      </div>
    </div>
    <script src="/docs/public-api/static/swagger-ui-bundle.js" charset="UTF-8"> </script>
    <script src="/docs/public-api/static/swagger-ui-standalone-preset.js" charset="UTF-8"> </script>
    <script src="/docs/public-api/swagger/swagger-initializer" charset="UTF-8"> </script>
    <script>
      (function() {
        function findTag(tagName) {
          return document.querySelector('#swagger-ui .opblock-tag[data-tag="' + tagName + '"]')
            || document.getElementById('operations-tag-' + tagName.replace(/\s+/g, '_'));
        }

        function scrollToTag(tagName) {
          var tagElement = findTag(tagName);
          if (!tagElement) return false;
          var button = tagElement.querySelector('button');
          if (button && button.getAttribute('aria-expanded') === 'false') {
            button.click();
          }
          tagElement.scrollIntoView({ behavior: 'smooth', block: 'start' });
          return true;
        }

        function navigateToTag(tagName) {
          window.location.hash = '#/' + encodeURIComponent(tagName);
          if (scrollToTag(tagName)) return;
          var root = document.getElementById('swagger-ui');
          if (!root) return;
          var observer = new MutationObserver(function() {
            if (scrollToTag(tagName)) observer.disconnect();
          });
          observer.observe(root, { childList: true, subtree: true });
        }

        fetch('/v3/api-docs/aegro-public-api')
          .then(function(r) { return r.json(); })
          .then(function(spec) {
            var toc = document.getElementById('swagger-toc');
            if (!toc || !spec.tags || !spec.tags.length) return;
            spec.tags.forEach(function(tag) {
              var name = tag.name || '';
              if (!name) return;
              var a = document.createElement('a');
              a.href = '#/' + encodeURIComponent(name);
              a.textContent = name;
              a.setAttribute('data-toc-tag', name);
              a.addEventListener('click', function(e) {
                e.preventDefault();
                navigateToTag(name);
              });
              toc.appendChild(a);
            });
            if (window.location.hash) {
              var hashTag = decodeURIComponent(window.location.hash.substring(2));
              navigateToTag(hashTag);
            }
          })
          .catch(function() {});

        window.addEventListener('hashchange', function() {
          if (window.location.hash) {
            var hashTag = decodeURIComponent(window.location.hash.substring(2));
            navigateToTag(hashTag);
          }
        });
      })();
    </script>
  </body>
</html>
