@using CarCareTracker.Helper
@inject IConfigHelper config
@inject ITranslationHelper translator
@model ServerSettingsViewModel
@{
    var userConfig = config.GetUserConfig(User);
    var userLanguage = userConfig.UserLanguage;
}
<div class="modal-header">
    <h5 class="modal-title" id="serverConfigModalLabel">@translator.Translate(userLanguage, "Review Server Configurations")</h5>
    <button type="button" class="btn-close" onclick="hideServerConfigModal()" aria-label="Close"></button>
</div>
<div class="modal-body">
    <form class="form-inline">
        <div class="form-group">
            <div class="row mb-2">
                <div class="col-md-6 col-12">
                    <label for="inputPostgres">@translator.Translate(userLanguage, "Postgres Connection")</label>
                </div>
                <div class="col-md-6 col-12">
                    <input type="text" readonly id="inputPostgres" class="form-control" placeholder="@translator.Translate(userLanguage, "Not Configured")" value="@Model.PostgresConnection">
                </div>
            </div>
            <div class="row mb-2">
                <div class="col-md-6 col-12">
                    <label for="inputFileExt">@translator.Translate(userLanguage, "Allowed File Extensions")</label>
                </div>
                <div class="col-md-6 col-12">
                    <input type="text" readonly id="inputFileExt" class="form-control" placeholder="@translator.Translate(userLanguage, "Not Configured")" value="@Model.AllowedFileExtensions">
                </div>
            </div>
            <div class="row mb-2">
                <div class="col-md-6 col-12">
                    <label for="inputLogoURL">@translator.Translate(userLanguage, "Logo URL")</label>
                </div>
                <div class="col-md-6 col-12">
                    <input type="text" readonly id="inputLogoURL" class="form-control" placeholder="@translator.Translate(userLanguage, "Not Configured")" value="@Model.CustomLogoURL">
                </div>
            </div>
            <div class="row mb-2">
                <div class="col-md-6 col-12">
                    <label for="inputMOTD">@translator.Translate(userLanguage, "Message of the Day")</label>
                </div>
                <div class="col-md-6 col-12">
                    <input type="text" readonly id="inputMOTD" class="form-control" placeholder="@translator.Translate(userLanguage, "Not Configured")" value="@Model.MessageOfTheDay">
                </div>
            </div>
            <div class="row mb-2">
                <div class="col-md-6 col-12">
                    <label for="inputWebHook">@translator.Translate(userLanguage, "WebHook URL")</label>
                </div>
                <div class="col-md-6 col-12">
                    <input type="text" readonly id="inputWebHook" class="form-control" placeholder="@translator.Translate(userLanguage, "Not Configured")" value="@Model.WebHookURL">
                </div>
            </div>
            <div class="row mb-2">
                <div class="col-md-6 col-12">
                    <label for="inputCustomWidget">@translator.Translate(userLanguage, "Custom Widgets")</label>
                </div>
                <div class="col-md-6 col-12">
                    <input type="text" readonly id="inputCustomWidget" class="form-control" placeholder="@translator.Translate(userLanguage, "Not Configured")" value="@(Model.CustomWidgetsEnabled ? translator.Translate(userLanguage, "Enabled") : translator.Translate(userLanguage, "Disabled"))">
                </div>
            </div>
            <div class="row mb-2">
                <div class="col-md-6 col-12">
                    <label for="inputInvariantAPI">@translator.Translate(userLanguage, "Invariant API")</label>
                </div>
                <div class="col-md-6 col-12">
                    <input type="text" readonly id="inputInvariantAPI" class="form-control" placeholder="@translator.Translate(userLanguage, "Not Configured")" value="@(Model.InvariantAPIEnabled ? translator.Translate(userLanguage, "Enabled") : translator.Translate(userLanguage, "Disabled"))">
                </div>
            </div>
            <hr />
            <div class="row mb-2">
                <div class="col-md-6 col-12">
                    <label for="inputSMTPServer">@translator.Translate(userLanguage, "SMTP Server")</label>
                </div>
                <div class="col-md-6 col-12">
                    <div class="input-group">
                        <input type="text" readonly id="inputSMTPServer" class="form-control" placeholder="@translator.Translate(userLanguage, "Not Configured")" value="@Model.SMTPConfig.EmailServer">
                        <div class="input-group-text">
                            <button type="button" @(string.IsNullOrWhiteSpace(Model.SMTPConfig.EmailServer) ? "disabled" : "") class="btn btn-sm text-secondary password-visible-button" onclick="sendTestEmail()"><i class="bi bi-send"></i></button>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row mb-2">
                <div class="col-md-6 col-12">
                    <label for="inputSMTPPort">@translator.Translate(userLanguage, "SMTP Server Port")</label>
                </div>
                <div class="col-md-6 col-12">
                    <input type="text" readonly id="inputSMTPPort" class="form-control" placeholder="@translator.Translate(userLanguage, "Not Configured")" value="@Model.SMTPConfig.Port">
                </div>
            </div>
            <div class="row mb-2">
                <div class="col-md-6 col-12">
                    <label for="inputSMTPFrom">@translator.Translate(userLanguage, "SMTP Sender Address")</label>
                </div>
                <div class="col-md-6 col-12">
                    <input type="text" readonly id="inputSMTPFrom" class="form-control" placeholder="@translator.Translate(userLanguage, "Not Configured")" value="@Model.SMTPConfig.EmailFrom">
                </div>
            </div>
            <div class="row mb-2">
                <div class="col-md-6 col-12">
                    <label for="inputSMTPUsername">@translator.Translate(userLanguage, "SMTP Username")</label>
                </div>
                <div class="col-md-6 col-12">
                    <input type="text" readonly id="inputSMTPUsername" class="form-control" placeholder="@translator.Translate(userLanguage, "Not Configured")" value="@Model.SMTPConfig.Username">
                </div>
            </div>
            <div class="row mb-2">
                <div class="col-md-6 col-12">
                    <label for="inputSMTPPassword">@translator.Translate(userLanguage, "SMTP Password")</label>
                </div>
                <div class="col-md-6 col-12">
                    <div class="input-group">
                        <input type="password" readonly id="inputSMTPPassword" class="form-control" placeholder="@translator.Translate(userLanguage, "Not Configured")" value="@Model.SMTPConfig.Password">
                        <div class="input-group-text">
                            <button type="button" class="btn btn-sm text-secondary password-visible-button" onclick="togglePasswordVisibility(this)"><i class="bi bi-eye"></i></button>
                        </div>
                    </div>
                </div>
            </div>
            <hr />
            <div class="row mb-2">
                <div class="col-md-6 col-12">
                    <label for="inputOIDCProvider">@translator.Translate(userLanguage, "OIDC Provider")</label>
                </div>
                <div class="col-md-6 col-12">
                    <input type="text" readonly id="inputOIDCProvider" class="form-control" placeholder="@translator.Translate(userLanguage, "Not Configured")" value="@Model.OIDCConfig.Name">
                </div>
            </div>
            <div class="row mb-2">
                <div class="col-md-6 col-12">
                    <label for="inputOIDCClient">@translator.Translate(userLanguage, "OIDC Client ID")</label>
                </div>
                <div class="col-md-6 col-12">
                    <input type="text" readonly id="inputOIDCClient" class="form-control" placeholder="@translator.Translate(userLanguage, "Not Configured")" value="@Model.OIDCConfig.ClientId">
                </div>
            </div>
             <div class="row mb-2">
                <div class="col-md-6 col-12">
                    <label for="inputOIDCSecret">@translator.Translate(userLanguage, "OIDC Client Secret")</label>
                </div>
                <div class="col-md-6 col-12">
                    <div class="input-group">
                        <input type="password" readonly id="inputOIDCSecret" class="form-control" placeholder="@translator.Translate(userLanguage, "Not Configured")" value="@Model.OIDCConfig.ClientSecret">
                        <div class="input-group-text">
                            <button type="button" class="btn btn-sm text-secondary password-visible-button" onclick="togglePasswordVisibility(this)"><i class="bi bi-eye"></i></button>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row mb-2">
                <div class="col-md-6 col-12">
                    <label for="inputOIDCAuth">@translator.Translate(userLanguage, "OIDC Auth URL")</label>
                </div>
                <div class="col-md-6 col-12">
                    <input type="text" readonly id="inputOIDCAuth" class="form-control" placeholder="@translator.Translate(userLanguage, "Not Configured")" value="@Model.OIDCConfig.AuthURL">
                </div>
            </div>
            <div class="row mb-2">
                <div class="col-md-6 col-12">
                    <label for="inputOIDCToken">@translator.Translate(userLanguage, "OIDC Token URL")</label>
                </div>
                <div class="col-md-6 col-12">
                    <input type="text" readonly id="inputOIDCToken" class="form-control" placeholder="@translator.Translate(userLanguage, "Not Configured")" value="@Model.OIDCConfig.TokenURL">
                </div>
            </div>
            <div class="row mb-2">
                <div class="col-md-6 col-12">
                    <label for="inputOIDCUserInfo">@translator.Translate(userLanguage, "OIDC UserInfo URL")</label>
                </div>
                <div class="col-md-6 col-12">
                    <input type="text" readonly id="inputOIDCUserInfo" class="form-control" placeholder="@translator.Translate(userLanguage, "Not Configured")" value="@Model.OIDCConfig.UserInfoURL">
                </div>
            </div>
             <div class="row mb-2">
                <div class="col-md-6 col-12">
                    <label for="inputOIDCRedirect">@translator.Translate(userLanguage, "OIDC Redirect URL")</label>
                </div>
                <div class="col-md-6 col-12">
                    <input type="text" readonly id="inputOIDCRedirect" class="form-control" placeholder="@translator.Translate(userLanguage, "Not Configured")" value="@Model.OIDCConfig.RedirectURL">
                </div>
            </div>
             <div class="row mb-2">
                <div class="col-md-6 col-12">
                    <label for="inputOIDCScope">@translator.Translate(userLanguage, "OIDC Scope")</label>
                </div>
                <div class="col-md-6 col-12">
                    <input type="text" readonly id="inputOIDCScope" class="form-control" placeholder="@translator.Translate(userLanguage, "Not Configured")" value="@Model.OIDCConfig.Scope">
                </div>
            </div>
             <div class="row mb-2">
                <div class="col-md-6 col-12">
                    <label for="inputOIDCLogout">@translator.Translate(userLanguage, "OIDC Logout URL")</label>
                </div>
                <div class="col-md-6 col-12">
                    <input type="text" readonly id="inputOIDCLogout" class="form-control" placeholder="@translator.Translate(userLanguage, "Not Configured")" value="@Model.OIDCConfig.LogOutURL">
                </div>
            </div>
             <div class="row mb-2">
                <div class="col-md-6 col-12">
                    <label for="inputOIDCState">@translator.Translate(userLanguage, "OIDC Validate State")</label>
                </div>
                <div class="col-md-6 col-12">
                    <input type="text" readonly id="inputOIDCState" class="form-control" placeholder="@translator.Translate(userLanguage, "Not Configured")" value="@(Model.OIDCConfig.ValidateState ? translator.Translate(userLanguage, "Enabled") : translator.Translate(userLanguage, "Disabled"))">
                </div>
            </div>
            <div class="row mb-2">
                <div class="col-md-6 col-12">
                    <label for="inputOIDCPKCE">@translator.Translate(userLanguage, "OIDC Use PKCE")</label>
                </div>
                <div class="col-md-6 col-12">
                    <input type="text" readonly id="inputOIDCPKCE" class="form-control" placeholder="@translator.Translate(userLanguage, "Not Configured")" value="@(Model.OIDCConfig.UsePKCE ? translator.Translate(userLanguage, "Enabled") : translator.Translate(userLanguage, "Disabled"))">
                </div>
            </div>
            <div class="row mb-2">
                <div class="col-md-6 col-12">
                    <label for="inputOIDCDisable">@translator.Translate(userLanguage, "OIDC Login Only")</label>
                </div>
                <div class="col-md-6 col-12">
                    <input type="text" readonly id="inputOIDCDisable" class="form-control" placeholder="@translator.Translate(userLanguage, "Not Configured")" value="@(Model.OIDCConfig.DisableRegularLogin ? translator.Translate(userLanguage, "Enabled") : translator.Translate(userLanguage, "Disabled"))">
                </div>
            </div>
        </div>
    </form>
</div>