// Server wrapper for the per-branch QR Storefront editor.
// Feature gating is handled client-side by FeatureGuard, which shows a
// blurred-content upgrade overlay instead of redirecting or throwing.
import { getSession } from '@server/auth';
import EditorClient from './EditorClient';
import NotSignedIn from '../NotSignedIn';
import FeatureGuard from '@client/components/FeatureGuard';

export default async function StorefrontBranchServerPage({
  params,
}: {
  params: Promise<{ branchId: string }>;
}) {
  const { branchId } = await params;
  const session = await getSession();
  const restaurantId = session?.restaurantId;
  if (!restaurantId) return <NotSignedIn scope="edit" />;
  return (
    <FeatureGuard feature="storefront" featureName="QR Storefront">
      <EditorClient branchId={branchId} />
    </FeatureGuard>
  );
}
