<div class="page__content">
    <h2>{{stepNumber}} - Robert2 core settings</h2>
    <p>
        In this step, the configuration has been <strong>automatically detected</strong>,
        but you can check and modify all settings, if you know what you're doing!
    </p>
    <form method="POST" class="form">
        <section class="form__field">
            <h3 class="form__field-title">API URL</h3>
            <p class="form__field-description">
                This is the base URL of the application, that you'll use everyday.
            </p>
            <input
                type="text"
                name="apiUrl"
                size="10"
                value="{{config['apiUrl']}}"
            />
        </section>
        <p>
            <a onclick="showHiddenFieldset()" id="showFieldset" class="form__fieldset-toggle">
                Show advanced settings...
            </a>
        </p>
        <fieldset class="form__fieldset form__fieldset--hidden">
            <section class="form__field form__field--hidden">
                <h3 class="form__field-title">Application name</h3>
                <p class="form__field-description">
                    The name of the application. Actually, known as... well, "Robert2".
                </p>
                <input
                    type="text"
                    name="basename"
                    value="{{config['basename']}}"
                />
            </section>
            <section class="form__field">
                <h3 class="form__field-title">
                    Enable CORS (Cross Origin Resource Sharing)
                </h3>
                <p class="form__field-description">
                    If enabled, it will be possible to use the API from another domain name
                    (less secure, but can be useful in certain cases).
                </p>
                <div class="form__radio">
                    <input
                        type="radio"
                        id="enableCorsYes"
                        name="enableCORS"
                        value="1"
                        {% if config['enableCORS'] %} checked="checked" {% endif %}
                    />
                    <label for="enableCorsYes">Yes</label>
                    <input
                        type="radio"
                        id="enableCorsNo"
                        name="enableCORS"
                        value="0"
                        {% if not config['enableCORS'] %} checked {% endif %}
                    />
                    <label for="enableCorsNo">No</label>
                </div>
            </section>
            <section class="form__field">
                <h3 class="form__field-title">
                    Display errors details
                </h3>
                <p class="form__field-description">
                    Wether to display errors in details or not.
                </p>
                <div class="form__radio">
                    <input
                        type="radio"
                        id="displayErrorsYes"
                        name="displayErrorDetails"
                        value="1"
                        {% if config['displayErrorDetails'] %} checked="checked" {% endif %}
                    />
                    <label for="displayErrorsYes">Yes</label>
                    <input
                        type="radio"
                        id="displayErrorsNo"
                        name="displayErrorDetails"
                        value="0"
                        {% if not config['displayErrorDetails'] %} checked {% endif %}
                    />
                    <label for="displayErrorsNo">No</label>
                </div>
            </section>
            <section class="form__field">
                <h3 class="form__field-title">Routing cache</h3>
                <p class="form__field-description">
                    Wether to use routing cache system or not.
                </p>
                <div class="form__radio">
                    <input
                        type="radio"
                        id="useRouterCacheYes"
                        name="useRouterCache"
                        value="1"
                        {% if config['useRouterCache'] %} checked="checked" {% endif %}
                    />
                    <label for="useRouterCacheYes">Yes</label>
                    <input
                        type="radio"
                        id="useRouterCacheNo"
                        name="useRouterCache"
                        value="0"
                        {% if not config['useRouterCache'] %} checked {% endif %}
                    />
                    <label for="useRouterCacheNo">No</label>
                </div>
            </section>
            <section class="form__field">
                <h3 class="form__field-title">
                    Use HTTPS
                </h3>
                <p class="form__field-description">
                    Wether to use HTTPS protocol or not.
                </p>
                <div class="form__radio">
                    <input
                        type="radio"
                        id="useHttpsYes"
                        name="useHTTPS"
                        value="1"
                        {% if config['useHTTPS'] %} checked="checked" {% endif %}
                    />
                    <label for="useHttpsYes">Yes</label>
                    <input
                        type="radio"
                        id="useHttpsNo"
                        name="useHTTPS"
                        value="0"
                        {% if not config['useHTTPS'] %} checked {% endif %}
                    />
                    <label for="useHttpsNo">No</label>
                </div>
            </section>
            <section class="form__field">
                <h3 class="form__field-title">
                    Sessions duration
                </h3>
                <p class="form__field-description">
                    Expiration time of a session: number of hours a session can last on Robert, before
                    the user must re-log into the application.
                </p>
                <div class="form__input">
                    <input
                        type="number"
                        step="1"
                        name="sessionExpireHours"
                        value="{{config['sessionExpireHours']}}"
                    />
                    <label for="sessionExpireHours">hours</label>
                </div>
            </section>
            <section class="form__field">
                <h3 class="form__field-title">
                    JWT Secret
                </h3>
                <p class="form__field-description">
                    This is a passphrase to enforce security. The value below is generated
                    randomly. But you can write your own phrase, so be inventive! Just avoid
                    spaces.
                </p>
                <input
                    type="text"
                    name="JWTSecret"
                    value="{{stepData['JWTSecret']}}"
                />
            </section>
            <section class="form__field">
                <h3 class="form__field-title">
                    HTTP AUTH Header name
                </h3>
                <p class="form__field-description">
                    This is the name of the HTTP Header that will be used to send your API access token
                    within every requests. In most case, it should be <code>Authorization</code>.
                </p>
                <input
                    type="text"
                    name="httpAuthHeader"
                    value="{{config['httpAuthHeader']}}"
                />
            </section>
            <p>
                <a onclick="hideHiddenFieldset()" class="form__fieldset-toggle">
                    ^^ Hide advanced settings ^^
                </a>
            </p>
        </fieldset>
        <section class="form__submit">
            <button role="submit">Next step</button>
        </section>
    </form>
</div>

<script src="js/install/fieldsetToggle.js"></script>
