import React from 'react';
import { prisma } from '@/app/lib/prisma';

export const dynamic = 'force-dynamic';

export default async function AdminDashboard() {
  const categoryCount = await prisma.category.count();
  const itemCount = await prisma.item.count();
  const restaurant = await prisma.restaurant.findFirst();

  return (
    <div className="admin-dashboard">
      <div className="admin-page-header">
        <h1>Dashboard</h1>
        <p>Luna Cocktail & More - Menü Özeti</p>
      </div>

      <div className="stats-grid">
        <div className="stat-card">
          <div className="stat-label">Toplam Kategori</div>
          <div className="stat-value">{categoryCount}</div>
        </div>
        <div className="stat-card">
          <div className="stat-label">Toplam Ürün</div>
          <div className="stat-value">{itemCount}</div>
        </div>
        <div className="stat-card">
          <div className="stat-label">Restoran İsmi</div>
          <div className="stat-value" style={{ fontSize: '1.2rem' }}>{restaurant?.name || 'Yükleniyor...'}</div>
        </div>
      </div>

      <div className="admin-card">
        <div className="card-header">
          <h2 className="card-title">Hızlı İşlemler</h2>
        </div>
        <div style={{ padding: '2rem', display: 'flex', gap: '1rem' }}>
          <button className="admin-btn">Yeni Kategori Ekle</button>
          <button className="admin-btn">Yeni Ürün Ekle</button>
        </div>
      </div>
    </div>
  );
}
