<div class="my-3">
    <span class="badge bg-success me-1">GET</span> <span class="badge bg-primary me-1">POST</span> - Allowed HTTP methods.
    <i class="fas fa-exclamation-triangle text-warning ms-3"></i> - Missing docstring.
    <i class="fas fa-info-circle text-info"></i> - Chained.
    <div class="alert alert-info mt-2 mb-0">
        <strong>Note:</strong> If your site uses Basic HTTP Authentication, add <code>-u USERNAME:PASSWORD</code> to each curl request.
    </div>
</div>
<input type="text" class="form-control mx-0 mb-3" placeholder="Search items..." data-module="search-through-content" data-module-target="#actions-accrd-parent .accordion-item">
<div>
    <div class="accordion row" id="actions-accrd-parent">
        {% for action in data.actions %}
        <div class="accordion-item border-0 col-lg-6 pb-3">
            <div class="border">              
              <h2 class="accordion-header" id="action-{{action.func_name}}-heading">
                <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#action-{{action.func_name}}" aria-expanded="false" aria-controls="action-{{action.func_name}}">
                  <div class="d-flex align-items-center flex-wrap gap-2">
                      <span class="h4 mb-0">{{ action.func_name }}</span>
                      {% if action.allowed_methods %}
                          {% for method in action.allowed_methods %}
                              {% if method == "GET" %}
                                  <span class="badge bg-success">GET</span>
                              {% elif method == "POST" %}
                                  <span class="badge bg-primary">POST</span>
                              {% endif %}
                          {% endfor %}
                      {% endif %}
                      {% if not action.docstring %}
                          <i class="fas fa-exclamation-triangle text-warning"></i>
                      {% endif %}
                      {% if action.chained %}
                          <i class="fas fa-info-circle text-info"></i>
                      {% endif %}
                  </div>
                </button>
              </h2>
              <div id="action-{{action.func_name}}" class="accordion-collapse collapse" aria-labelledby="action-{{action.func_name}}-heading">
                <div class="accordion-body">
                  {% if action.docstring %}
                      <pre>{{ action.docstring }}</pre>
                  {% else %}
                      <p>Missing docstring for this Action.</p>
                  {% endif %}
                  
                  {% if action.curl_examples %}
                      <div class="mt-3">
                          <h5>cURL Examples</h5>
                          {% for example in action.curl_examples %}
                              <div class="mb-3">
                                  <div class="d-flex align-items-center gap-2 mb-2">
                                      <span class="badge {% if example.method == 'GET' %}bg-success{% else %}bg-primary{% endif %}">
                                          {{ example.method }}
                                      </span>
                                      <button class="btn btn-sm btn-outline-secondary" 
                                              onclick="navigator.clipboard.writeText(this.parentElement.nextElementSibling.textContent.trim()); this.textContent='Copied!'; setTimeout(() => this.textContent='Copy', 2000)">
                                          Copy
                                      </button>
                                  </div>
                                  <pre class="bg-light p-2 rounded border"><code>{{ example.curl }}</code></pre>
                              </div>
                          {% endfor %}
                      </div>
                  {% endif %}
                </div>
              </div>
            </div>
          </div>
        {% endfor %}
    </div>
</div>
