{#
Bengal OpenAPI Playground Bar
=============================

Displays: HTTP method badge + endpoint path + copy button
A compact, actionable header for API endpoints.

Context:
- method: HTTP method (GET, POST, PUT, PATCH, DELETE, etc.)
- path: Endpoint path (e.g., "/users/{id}")
- deprecated: bool (optional, default false)
- base_url: Base API URL (optional)

Kida Features:
- {% spaceless %} for compact badge output
- {% match %} for method styling
- Optional chaining (?.) and null coalescing (??)
#}
{% let method_upper = method |> upper ?? 'GET' %}
{% let method_lower = method |> lower ?? 'get' %}
{% let is_deprecated = deprecated ?? false %}
{% let api_base = base_url ?? '' %}

<div class="api-playground-bar{% if is_deprecated %} api-playground-bar--deprecated{% end %}">
  <div class="api-playground-bar__method-path">
    {# HTTP Method Badge #}
    {% spaceless %}
    <span class="api-method api-method--{{ method_lower }}">{{ method_upper }}</span>
    {% end %}

    {# Endpoint Path with highlighted params #}
    <code class="api-playground-bar__path">{% spaceless %}
      {{ path | highlight_path_params | safe }}
    {% end %}</code>
  </div>

  {# Copy Button #}
  <button
    class="api-playground-bar__copy"
    data-copy="{{ api_base }}{{ path }}"
    aria-label="Copy endpoint URL"
    title="Copy endpoint URL"
  >
    {{ icon('copy', size=14) }}
    <span class="api-playground-bar__copy-text">Copy</span>
  </button>
</div>

{# Deprecated Banner (if applicable) #}
{% if is_deprecated %}
<div class="api-deprecated-banner" role="alert">
  {{ icon('alert-triangle', size=16) }}
  <span>This endpoint is deprecated and may be removed in a future version.</span>
</div>
{% end %}
