"use client";

import { NeonAuthUIProvider, UserButton } from "@neondatabase/auth/react";
import type { ReactNode } from "react";
import { ThemeProvider } from "@/components/theme-provider";
import { authClient } from "@/lib/auth/client";

export function Providers({ children }: { children: ReactNode }) {
  return (
    <ThemeProvider
      attribute="class"
      defaultTheme="system"
      enableSystem
      disableTransitionOnChange
    >
      <NeonAuthUIProvider
        authClient={authClient}
        redirectTo="/dashboard"
        emailOTP
        credentials={{ forgotPassword: true }}
      >
        {children}
      </NeonAuthUIProvider>
    </ThemeProvider>
  );
}

// Export UserButton for use in layouts
export { UserButton };
