{% extends "layout.html" %}

{% block content %}
<div class="container">
    <div class="row justify-content-center">
        <div class="col-md-8">
            <div class="card">
                <div class="card-header bg-warning text-dark">
                    <i class="bi bi-arrow-left-right"></i> Transfer Character
                </div>
                <div class="card-body">
                    <div class="alert alert-info mb-4">
                        <i class="bi bi-info-circle"></i> 
                        <strong>Transferring:</strong> {{ character.name }} ({{ character.slug }})
                        <br>
                        <small>This will create a new entity in the target category. The original character will remain unchanged.</small>
                    </div>
                    
                    <form action="{{ url_for('transfer_character', slug=character.slug) }}" method="post">
                        <div class="mb-3">
                            <label for="target_type" class="form-label">Target Category</label>
                            <select class="form-select" id="target_type" name="target_type" required>
                                <option value="">Select target category...</option>
                                <option value="look">Look (Character Appearance)</option>
                                <option value="outfit">Outfit (Clothing)</option>
                                <option value="action">Action (Pose/Activity)</option>
                                <option value="style">Style (Artistic Style)</option>
                                <option value="scene">Scene (Background/Environment)</option>
                                <option value="detailer">Detailer (Enhancement)</option>
                            </select>
                            <div class="form-text">Select where you want to transfer this character to.</div>
                        </div>
                        
                        <div class="mb-3">
                            <label for="new_name" class="form-label">New Name</label>
                            <input type="text" class="form-control" id="new_name" name="new_name" 
                                   value="{{ character.name }}" required>
                            <div class="form-text">Name for the new entity in the target category.</div>
                        </div>
                        
                        <div class="mb-3 form-check form-switch">
                            <input class="form-check-input" type="checkbox" id="use_llm" name="use_llm" checked>
                            <label class="form-check-label" for="use_llm">
                                <strong>Use AI to regenerate JSON</strong>
                            </label>
                            <div class="form-text">
                                <div class="alert alert-light border mt-2">
                                    <i class="bi bi-lightbulb"></i> 
                                    <strong>AI Regeneration:</strong> The AI will analyze the character profile and create a new JSON structure appropriate for the target category.
                                    <br>
                                    <strong>Without AI:</strong> A blank template will be created with basic information transferred.
                                </div>
                            </div>
                        </div>
                        
                        <div class="alert alert-warning">
                            <i class="bi bi-exclamation-triangle"></i>
                            <strong>Important:</strong> The original JSON structure cannot be reused directly. 
                            Each category has different required fields and structure. 
                            AI regeneration ensures the new entity is properly formatted for its category.
                        </div>
                        
                        <div class="d-grid gap-2">
                            <button type="submit" class="btn btn-warning btn-lg">
                                <i class="bi bi-arrow-left-right"></i> Transfer Character
                            </button>
                            <a href="{{ url_for('detail', slug=character.slug) }}" class="btn btn-outline-secondary">
                                Cancel
                            </a>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}