{% extends "base.html" %}

{% block title %}{{ t('checkpoints.title') }}{% endblock %}
{% block page_id %}checkpoints{% endblock %}

{% block init_title %}{{ t('initialization.checkpoints.title') }}{% endblock %}
{% block init_message %}{{ t('initialization.checkpoints.message') }}{% endblock %}
{% block init_check_url %}/api/checkpoints/list?page=1&page_size=1{% endblock %}

{% block additional_components %}

<div id="checkpointContextMenu" class="context-menu" style="display: none;">
    <!-- Metadata -->
    <div class="context-menu-item" data-action="refresh-metadata"><i class="fas fa-sync"></i> {{ t('loras.contextMenu.refreshMetadata') }}</div>
    <div class="context-menu-item has-submenu" data-has-submenu="link-model">
        <i class="fas fa-link"></i>
        <span>{{ t('loras.contextMenu.linkModel') }}</span>
        <i class="fas fa-chevron-right submenu-arrow"></i>
        <div class="context-submenu">
            <div class="context-menu-item" data-action="relink-civitai">
                <i class="fas fa-external-link-alt"></i> <span>{{ t('loras.contextMenu.linkCivitai') }}</span>
            </div>
            <div class="context-menu-item" data-action="link-hf">
                <i class="fas fa-robot"></i> <span>{{ t('loras.contextMenu.linkHuggingFace') }}</span>
            </div>
        </div>
    </div>
    <div class="context-menu-separator menu-section-break"></div>
    <!-- Workflow -->
    <div class="context-menu-item" data-action="copyname"><i class="fas fa-copy"></i> {{ t('loras.contextMenu.copyFilename') }}</div>
    <div class="context-menu-item" data-action="sendworkflow"><i class="fas fa-paper-plane"></i> {{ t('checkpoints.contextMenu.sendToWorkflow') }}</div>
    <div class="context-menu-separator menu-section-break"></div>
    <!-- Media / Preview -->
    <div class="context-menu-item" data-action="preview"><i class="fas fa-folder-open"></i> {{ t('loras.contextMenu.openExamples') }}</div>
    <div class="context-menu-item has-submenu" data-has-submenu="download-examples"><i class="fas fa-download"></i> {{ t('loras.contextMenu.downloadExamples') }} <i class="fas fa-chevron-right submenu-arrow"></i>
        <div class="context-submenu">
            <div class="context-menu-item" data-action="download-examples"><i class="fas fa-download"></i> {{ t('loras.contextMenu.downloadMissingExamples') }}</div>
            <div class="context-menu-item" data-action="download-examples-force"><i class="fas fa-redo-alt"></i> {{ t('loras.contextMenu.reprocessExamples') }}</div>
        </div>
    </div>
    <div class="context-menu-item" data-action="replace-preview"><i class="fas fa-image"></i> {{ t('loras.contextMenu.replacePreview') }}</div>
    <div class="context-menu-separator menu-section-break"></div>
    <!-- Attributes -->
    <div class="context-menu-item" data-action="set-nsfw"><i class="fas fa-exclamation-triangle"></i> {{ t('loras.contextMenu.setContentRating') }}</div>
    <div class="context-menu-separator menu-section-break"></div>
    <!-- Organization -->
    <div class="context-menu-item" data-action="move"><i class="fas fa-folder-open"></i> {{ t('loras.contextMenu.moveToFolder') }}</div>
    <div class="context-menu-item" data-action="move-other"><i class="fas fa-exchange-alt"></i> {{ t('checkpoints.contextMenu.moveToOtherTypeFolder', {otherType: '...'}) }}</div>
    <div class="context-menu-separator"></div>
    <!-- Destructive -->
    <div class="context-menu-item" data-action="exclude"><i class="fas fa-eye-slash"></i> {{ t('loras.contextMenu.excludeModel') }}</div>
    <div class="context-menu-item delete-item" data-action="delete"><i class="fas fa-trash"></i> {{ t('loras.contextMenu.deleteModel') }}</div>
</div>
{% endblock %}

{% block content %}
    {% include 'components/controls.html' %}
    {% include 'components/breadcrumb.html' %}
    {% include 'components/duplicates_banner.html' %}
    {% include 'components/folder_sidebar.html' %}
    
    <!-- Checkpoint cards container -->
    <div class="card-grid" id="modelGrid">
        <!-- Cards will be dynamically inserted here -->
    </div>
{% endblock %}

{% block overlay %}
<div class="bulk-mode-overlay"></div>
{% endblock %}

{% block main_script %}
<script type="module" src="/loras_static/js/checkpoints.js?v={{ version }}"></script>
{% endblock %}
