{% extends "layout.html" %}

{% block title %}{% trans %}Configure Server{% endtrans %}{% endblock %}

{% block content %}
    <article>
        <header>
            <h2>{% trans %}Choose a provider{% endtrans %}</h2>
        </header>

        <p>{% trans %}Enter the URL of your OAuth2 or OpenID Connect provider to validate it and discover configuration options.{% endtrans %}</p>

        <form method="POST" action="{{ url_for('routes.configure_server') }}">
            {{ form.hidden_tag() }}

            <label for="{{ form.issuer_url.id }}">
                {{ form.issuer_url.label }}
            </label>

            {% if form.issuer_url.errors %}
                {% for error in form.issuer_url.errors %}
                    <small class="error">{{ error }}</small>
                {% endfor %}
            {% endif %}

            <div role="group">
                {{ form.issuer_url(class="form-control") }}
                {{ form.submit(class="primary") }}
            </div>
        </form>

        <details>
            <summary role="button" class="outline">{% trans %}What happens next?{% endtrans %}</summary>
            <ol>
                <li>{% trans %}Auth Playground will fetch the server's metadata from{% endtrans %} <code>/.well-known/openid-configuration</code> {% trans %}or{% endtrans %} <code>/.well-known/oauth-authorization-server</code></li>
                <li>{% trans %}If valid, Auth Playground will show you multiple configuration options:{% endtrans %}
                    <ul>
                        <li>{% trans %}Automatic registration (if supported){% endtrans %}</li>
                        <li>{% trans %}Manual configuration via web form{% endtrans %}</li>
                        <li>{% trans %}Environment variables setup{% endtrans %}</li>
                    </ul>
                </li>
            </ol>
        </details>
    </article>

    {% if config.DEBUG %}
        {% include "static-configuration.html" %}
    {% endif %}
{% endblock %}
