"use client";

import { PageHeader } from "@/components/ds";
import { useTenantId } from "@/hooks/useTenantId";
import { LoyaltyBreadcrumbs } from "@/modules/loyalty/components/LoyaltyBreadcrumbs";
import {
  LoyaltyCountsGrid,
  LoyaltyPageLoader,
  LoyaltyServiceBadge,
  useLoyaltyHealth,
} from "@/modules/loyalty/pages/shared";

export default function ExecutiveDashboard() {
  const { tenantId } = useTenantId();
  const health = useLoyaltyHealth();
  if (!tenantId) return <LoyaltyPageLoader />;
  return (
    <div className="space-y-6">
      <LoyaltyBreadcrumbs items={[{ label: "داشبورد مدیریتی" }]} />
      <PageHeader
        title="داشبورد مدیریتی"
        description="نمای اجرایی پلتفرم وفاداری — آمار واقعی از API."
        actions={<LoyaltyServiceBadge />}
      />
      <LoyaltyCountsGrid tenantId={tenantId} />
      {health.data ? (
        <p className="text-xs text-[var(--muted)]">
          سرویس {health.data.service} نسخه {health.data.version} — وضعیت {health.data.status}
        </p>
      ) : null}
    </div>
  );
}
