{% extends "partials/_generic_modal.html" %}

{% block modal_id %}revoke-confirm-modal{% endblock %}
{% block modal_event_id %}revoke-confirm-modal{% endblock %}
{% block modal_event_id_close %}revoke-confirm-modal{% endblock %}

{# No header for consistency #}
{% block modal_header %}{% endblock %}

{% block modal_size_class %}sm:max-w-lg{% endblock %}

{% block modal_icon_bg %}bg-yellow-100{% endblock %}
{% block modal_icon_color %}text-yellow-600{% endblock %}
{% block modal_icon %}
<i aria-hidden="true" data-lucide="shield-alert" class="h-6 w-6"></i>
{% endblock %}

{% block modal_body_title %}
<h3 class="text-lg leading-6 font-medium text-gray-900" id="modal-title-revoke">
  Revoke API Key
</h3>
{% endblock %}

{% block modal_content_margin %}sm:ml-4{% endblock %}

{% block modal_body %}
<div class="mt-2">
  <p class="text-sm text-gray-500">
    Are you sure you want to revoke this API key? It will immediately stop working and cannot be reactivated.
  </p>
</div>
{% endblock %}

{% block modal_footer_bg %}bg-gray-50{% endblock %}

{% block modal_footer %}
<button 
  type="button"
  class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-yellow-600 text-base font-medium text-white hover:bg-yellow-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-yellow-500 sm:ml-3 sm:w-auto sm:text-sm"
  {# Use actionUrl for PATCH request and close modal #}
  @click="if (actionUrl) { htmx.ajax('PATCH', actionUrl, {target: '#api-key-result', swap: 'innerHTML'}); $dispatch('close-modal', { id: 'revoke-confirm-modal' }) }"
>
  Confirm Revoke
</button>
<button 
  type="button"
  class="mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm"
  @click="$dispatch('close-modal', { id: 'revoke-confirm-modal' })"
>
  Cancel
</button>
{% endblock %}
