"use client";

import { EmptyState } from "@/components/ds";
import type { CapabilitiesResponse } from "@/modules/sports-center/types";

export function SportsCenterFeatureGate({
  feature,
  capabilities,
  children,
}: {
  feature: string;
  capabilities?: CapabilitiesResponse;
  children: React.ReactNode;
}) {
  const enabled = capabilities?.features?.[feature];
  if (capabilities && enabled === false) {
    return (
      <EmptyState
        title="قابلیت فعال نیست"
        description={`این بخش (${feature}) در سرویس مرکز ورزشی فعال نشده است.`}
      />
    );
  }
  return <>{children}</>;
}
