<div class="panel panel-default">
  <div class="panel-heading">
    <h3 class="panel-title">HexaHost GameCloud — Dashboard</h3>
  </div>
  <div class="panel-body">
    <p>
      <a href="{{modulelink}}" class="btn btn-default">Dashboard</a>
      <a href="{{modulelink}}&action=events" class="btn btn-default">Events</a>
      <a href="{{modulelink}}&action=reconciliation" class="btn btn-default">Reconciliation</a>
      <a href="{{modulelink}}&action=mappings" class="btn btn-default">Mappings</a>
      <a href="{{modulelink}}&action=mtls" class="btn btn-default">mTLS</a>
      <a href="{{modulelink}}&action=poll" class="btn btn-primary">Poll events now</a>
    </p>

    <div class="row">
      <div class="col-md-3">
        <div class="well text-center">
          <h4>{{health.status}}</h4>
          <small>API status</small>
        </div>
      </div>
      <div class="col-md-3">
        <div class="well text-center">
          <h4>{{stats.linkedServices}}</h4>
          <small>Linked services</small>
        </div>
      </div>
      <div class="col-md-3">
        <div class="well text-center">
          <h4>{{unlinkedWhmcsServices}}</h4>
          <small>Unlinked WHMCS services</small>
        </div>
      </div>
      <div class="col-md-3">
        <div class="well text-center">
          <h4>{{stats.pendingEvents}}</h4>
          <small>Pending GameCloud events</small>
        </div>
      </div>
    </div>

    <table class="table table-striped">
      <tbody>
        <tr><th>Addon version</th><td>{{version}}</td></tr>
        <tr><th>Integration ID</th><td>{{stats.integrationId}}</td></tr>
        <tr><th>Billing provider</th><td>{{stats.billingProvider}}</td></tr>
        <tr><th>Linked clients</th><td>{{stats.linkedClients}}</td></tr>
        <tr><th>Open reconciliation issues</th><td>{{stats.openReconciliationIssues}}</td></tr>
        <tr><th>Dead-letter events</th><td>{{stats.deadLetterEvents}}</td></tr>
        <tr><th>Usage exports</th><td>{{stats.exportedUsagePeriods}}</td></tr>
        <tr><th>Last reconciliation</th><td>{{stats.lastReconciliationAt}}</td></tr>
        <tr><th>Last event sync</th><td>{{stats.lastEventSyncAt}}</td></tr>
        <tr><th>Last error</th><td>{{lastError}}</td></tr>
        <tr><th>mTLS enabled (GameCloud)</th><td>{{stats.mtlsEnabled}}</td></tr>
        <tr><th>mTLS fingerprint registered</th><td>{{stats.mtlsFingerprintRegistered}}</td></tr>
      </tbody>
    </table>
  </div>
</div>
