@page "/admin/system"

@using Moonlight.Shared.Components.Navigations
@using Moonlight.App.Helpers
@using Moonlight.App.Services

@inject HostSystemHelper HostSystemHelper
@inject MoonlightService MoonlightService

<OnlyAdmin>
    <AdminSystemNavigation Index="0"/>

    <LazyLoader Load="Load">
        <div class="row">
                <div class="col-xxl-6 my-3">
                    <div class="card">
                        <div class="card-header">
                            <span class="card-title">
                                <TL>Version</TL>
                            </span>
                        </div>
                        <div class="card-body">
                            <span class="fs-5">
                                <TL>You are running moonlight version</TL>
                                <span class="text-primary">@(MoonlightService.AppVersion)</span>
                            </span>
                        </div>
                    </div>
                </div>
                <div class="col-xxl-6 my-3">
                    <div class="card">
                        <div class="card-header">
                            <span class="card-title">
                                <TL>Operating system</TL>
                            </span>
                        </div>
                        <div class="card-body">
                            <span class="fs-5">
                                <TL>Moonlight is running on</TL>
                                <span class="text-primary">@(HostSystemHelper.GetOsName())</span>
                            </span>
                        </div>
                    </div>
                </div>
                <div class="col-xxl-6 my-3">
                    <div class="card">
                        <div class="card-header">
                            <span class="card-title">
                                <TL>Memory usage</TL>
                            </span>
                        </div>
                        <div class="card-body">
                            <span class="fs-5">
                                <TL>Moonlight is using</TL>
                                <span class="text-primary">@(HostSystemHelper.GetMemoryUsage()) MB</span>
                                <TL>of memory</TL>
                            </span>
                        </div>
                    </div>
                </div>
                <div class="col-xxl-6 my-3">
                    <div class="card">
                        <div class="card-header">
                            <span class="card-title">
                                <TL>Cpu usage</TL>
                            </span>
                        </div>
                        <div class="card-body">
                            <span class="fs-5">
                                <TL>Moonlight is using</TL>
                                <span class="text-primary">@(HostSystemHelper.GetCpuUsage()) %</span>
                            </span>
                        </div>
                    </div>
                </div>
                <div class="col-xxl-6 my-3">
                    <div class="card">
                        <div class="card-header">
                            <span class="card-title">
                                <TL>Uptime</TL>
                            </span>
                        </div>
                        <div class="card-body">
                            <span class="fs-5">
                                <TL>Moonlight is since</TL>
                                <span class="text-primary">
                                    @(Formatter.FormatUptime(DateTime.UtcNow - MoonlightService.StartTimestamp))
                                </span>
                            </span>
                        </div>
                    </div>
                </div>
            </div>
    </LazyLoader>
</OnlyAdmin>

@code
{
    private Task Load(LazyLoader arg)
    {
        return Task.CompletedTask;
    }
}
