'use client';

import { usePathname } from 'next/navigation';
import { ApiKeyWidget } from '@/components/shared/ApiKeyWidget/apikey-widget';
import { ApiKeyProvider } from '@/components/shared/ApiKeyWidget/apikey-context';
import { PageProvider } from '@/contexts/page-context';

const navItems = [
  { label: 'Text to Image', href: '/demo/tti' },
  { label: 'Upload', href: '/demo/upload' },
  { label: 'Gallery', href: '/demo/gallery' },
];

export default function DemoLayout({ children }: { children: React.ReactNode }) {
  const pathname = usePathname();

  return (
    <ApiKeyProvider>
      <PageProvider
        navItems={navItems}
        currentPath={pathname}
        rightSlot={<ApiKeyWidget />}
      >
        {children}
      </PageProvider>
    </ApiKeyProvider>
  );
}
