@page "/setup"
@using Moonlight.App.Services

@inject ConfigService ConfigService
@inject NavigationManager NavigationManager
@inject SmartTranslateService SmartTranslateService

<IsSetup>
    <div class="card col d-flex justify-content-center">
        <div class="card-header">
            <span class="card-title"><TL>Configure basics</TL> (1/4)</span>
        </div>
        <div class="card-body p-10">
            <label class="form-label">
                <TL>Brand name</TL>
            </label>
            <div class="input-group mb-5">
                <span class="input-group-text">
                    <i class="bx bx-purchase-tag-alt"></i>
                </span>
                <input
                    @bind="@(ConfigService.GetSection("Moonlight").GetSection("Marketing")["BrandName"])"
                    type="text"
                    class="form-control"
                    placeholder="@(SmartTranslateService.Translate("Insert brand name..."))">
            </div>
            <div class="input-group mt-5">
                <WButton Text="@(SmartTranslateService.Translate("Save and continue"))"
                         WorkingText="@(SmartTranslateService.Translate("Saving"))"
                         CssClasses="btn-success"
                         OnClick="Save">
                </WButton>
                <a href="/setup/users" class="btn btn-primary">
                    <TL>Next</TL>
                </a>
            </div>
        </div>
    </div>
</IsSetup>
<NonSetup>
    <SetupCompletedAlert></SetupCompletedAlert>
</NonSetup>

@code
{
    private Task Save()
    {
        ConfigService.Save();
        NavigationManager.NavigateTo("/setup/users");

        return Task.CompletedTask;
    }
}