/**
 * Admin dashboard page.
 *
 * ⚠️ AUTO-GENERATED BY PRISM (GENERATE_ONCE)
 */

import { useEffect, useState } from 'react';
import { adminApi } from '../../lib/adminApi';

export default function AdminDashboard() {
  const [stats, setStats] = useState<{ total: number; active: number } | null>(null);
  const [error, setError] = useState('');

  useEffect(() => {
    adminApi
      .listUsers(0, 1)
      .then((res) => setStats({ total: res.total, active: res.total }))
      .catch((err) => setError(err.message));
  }, []);

  return (
    <div>
      <h1 className="text-2xl font-bold text-nordic-900 mb-6">Admin Dashboard</h1>
      {error && <p className="text-red-600 mb-4">{error}</p>}
      {stats && (
        <div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
          <div className="bg-white rounded-lg border border-nordic-200 p-6">
            <p className="text-sm text-nordic-500">Total Users</p>
            <p className="text-3xl font-bold text-nordic-900">{stats.total}</p>
          </div>
        </div>
      )}
    </div>
  );
}
