{{define "server_new.html"}}
{{template "partials/header.html" .}}

<h1>Nouveau Serveur</h1>

<p class="user-info">
    Ajoutez un serveur pour le gérer depuis l'interface admin.
</p>

<article>
    <form action="/admin/infra/servers/new" method="post">
        <input type="hidden" name="csrf_token" value="{{.CSRFToken}}">

        <div class="grid">
            <label>
                Nom *
                <input type="text" name="name" placeholder="in3" required>
                <small>Identifiant unique du serveur</small>
            </label>
            <label>
                Host *
                <input type="text" name="host" placeholder="192.168.1.100 ou hostname.local" required>
                <small>IP ou hostname pour la connexion SSH</small>
            </label>
        </div>

        <div class="grid">
            <label>
                VPN IP
                <input type="text" name="vpn_ip" placeholder="11.1.2.1">
                <small>IP WireGuard (optionnel)</small>
            </label>
            <label>
                Port SSH
                <input type="number" name="ssh_port" value="22" min="1" max="65535">
            </label>
        </div>

        <div class="grid">
            <label>
                Utilisateur SSH
                <input type="text" name="ssh_user" value="root" required>
            </label>
            <label>
                Fichier clé SSH *
                <input type="text" name="ssh_key_file" placeholder="/root/.ssh/id_ed25519" required>
                <small>Chemin vers la clé privée sur le container admin</small>
            </label>
        </div>

        <fieldset>
            <legend>Services disponibles</legend>
            <label>
                <input type="checkbox" name="has_incus">
                Incus (gestion de containers)
            </label>
            <label>
                <input type="checkbox" name="has_nginx">
                Nginx (reverse proxy)
            </label>
        </fieldset>

        <div style="display:flex;gap:1rem;margin-top:1rem;">
            <button type="submit">Créer le serveur</button>
            <a href="/admin/infra" role="button" class="outline secondary">Annuler</a>
        </div>
    </form>
</article>

{{template "partials/footer.html" .}}
{{end}}
