<html>
<head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>HTTP Status Page</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-F3w7mX95PdgyTmZZMECAngseQB83DfGTowi0iMjiWaeVhAn4FJkqJByhZMI3AhiU" crossorigin="anonymous">
</head>
<body>
<div class="container">
    <div class="row">
        <div class="col-md-12">
            <h1>HTTP Status Page</h1>
        </div>
    </div>
<div class="row">
    <div class="col-md-6">
        <div class="card">
            <div class="card-header {{if .checks.DiscSpace.Success }}bg-success{{else}}bg-danger{{end}}" id="hddtitle">
                Check HDD
            </div>
            <div class="card-body" id="hddpercent">

                <table class="table">
                    {{range $key, $val := .checks.DiscSpace.Data}}
                    <tr>
                        <td style="width: 20%">{{ $key }}</td>
                        <td>
                            <div class="progress">
                                <div class="progress-bar" role="progressbar" style="width: {{ $val }}%;" aria-valuenow="{{ $val }}" aria-valuemin="0" aria-valuemax="100">{{ $val }}%</div>
                            </div>
                        </td>
                    </tr>
                    {{end }}
                </table>


            </div>
        </div>
    </div>
    <div class="col-md-6">
        <div class="card">
            <div class="card-header {{if .checks.MemoryUsage.Success }}bg-success{{else}}bg-danger{{end}}" id="ramtitle">
                Check RAM

            </div>
            <div class="card-body">
                {{ if .checks.MemoryUsage.Data }}
                <table class="table">
                    <tr>
                        <th style="width: 20%">Ram</th>
                        <td>
                            <div class="progress">
                                <div class="progress-bar" role="progressbar" style="width: {{ .checks.MemoryUsage.Data.ram }}%;" aria-valuenow="{{ .checks.MemoryUsage.Data.ram }}" aria-valuemin="0" aria-valuemax="100">{{ .checks.MemoryUsage.Data.ram }}%</div>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <th style="width: 20%">Swap</th>
                        <td>
                            <div class="progress">
                                <div class="progress-bar" role="progressbar" style="width: {{ .checks.MemoryUsage.Data.swap }}%;" aria-valuenow="{{ .checks.MemoryUsage.Data.swap }}" aria-valuemin="0" aria-valuemax="100">{{ .checks.MemoryUsage.Data.swap }}%</div>
                            </div>
                        </td>
                    </tr>
                </table>
                {{ end }}
            </div>
        </div>
    </div>
</div>
    <div class="row" style="margin-top: 20px;">
        <div class="col-md-6">
            <div class="card">
                <div class="card-header {{if .checks.SystemLoad.Success }}bg-success{{else}}bg-danger{{end}}" id="loadtitle">
                    Check Load

                </div>
                <div class="card-body">
                    {{ if .checks.SystemLoad.Data }}
                    <table class="table">
                        <tr>
                            <th style="width: 20%">1</th>
                            <td>{{ .checks.SystemLoad.Data.Loadavg1 }}</td>
                        </tr>
                        <tr>
                            <th style="width: 20%">5</th>
                            <td>{{ .checks.SystemLoad.Data.Loadavg5 }}</td>
                        </tr>
                        <tr>
                            <th style="width: 20%">15</th>
                            <td>{{ .checks.SystemLoad.Data.Loadavg15 }}</td>
                        </tr>
                    </table>
                    {{ end }}
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="card">
                <div class="card-header {{if .checks.SystemdStatus.Success }}bg-success{{else}}bg-danger{{end}}" id="systemdtitle">
                    Systemd Check
                </div>
                <div class="card-body">
                    <table class="table">
                        {{range $key, $val := .checks.SystemdStatus.Data}}
                        <tr>
                            <td>{{ $key }}</td>
                            <td>
                               {{ $val }}
                            </td>
                        </tr>
                        {{end }}
                    </table>
                </div>
            </div>
        </div>
    </div>
    <div class="row" style="margin-top: 20px;">
        <div class="col-md-6">
            <div class="card">
                <div class="card-header {{if .checks.Version.Success }}bg-success{{else}}bg-danger{{end}}" id="loadtitle">
                    Version

                </div>
                <div class="card-body">
                    {{ if .checks.Version.Data }}
                    Newest Version: {{ .checks.Version.Data.version }}
                    {{ end }}
                </div>
            </div>
        </div>
        <div class="col-md-6">
        </div>
    </div>
</div>
</div>



<div class="container">
    <footer class="d-flex flex-wrap justify-content-between align-items-center py-3 my-4 border-top">
        <div class="col-md-4 d-flex align-items-center">
            <a href="/" class="mb-3 me-2 mb-md-0 text-muted text-decoration-none lh-1">
                <svg class="bi" width="30" height="24"><use xlink:href="#bootstrap"/></svg>
            </a>
            <span class="text-muted">Version: {{ .version }}</span>
        </div>

        <ul class="nav col-md-4 justify-content-end list-unstyled d-flex">
            <li><a href="https://git.keks.cloud/kekskurse/http-server-status">Git/Source Code</a></li>
        </ul>
    </footer>
</div>
</body>
</html>