<% admin_tool do %>
  <details>
    <summary>
      Inspect "<%= record.class.name.underscore %>" record
    </summary>

    <% unless record.nil? %>
      <% if record.is_a?(Norairrecord::Table) %>
        <%== ap record.fields%>
      <% else %>
        <%== ap record %>
      <% end %>
      <div class="border-left ml1">

        <!-- JSON -->
        <details class="ml2">
          <summary>
            View JSON
          </summary>
          <div class="overflow-x-auto">
            <pre class="w-max">
<%= JSON.pretty_generate(record.as_json) %>
            </pre>
          </div>
        </details>
      </div>

    <% else %>

      <p>
        <code>nil</code> (does not exist)
      </p>

    <% end %>
  </details>
<% end %>
