/**
 * Auth Page - Server Component Wrapper for Next.js App Router
 *
 * Default auth UI: login, register, forgot, reset, confirm, logout at /auth/[...auth].
 * Re-export in your app: export { default } from '@zen/core/features/auth/page';
 *
 * For custom auth pages (all flows) that match your site style, use components from
 * '@zen/core/features/auth/components' and actions from '@zen/core/features/auth/actions'.
 * See README-custom-login.md in this package. Basic sites can keep using this default page.
 */

import { AuthPagesClient } from '@zen/core/features/auth/pages';
import {
  registerAction,
  loginAction,
  logoutAction,
  forgotPasswordAction,
  resetPasswordAction,
  verifyEmailAction,
  setSessionCookie,
  getSession
} from '@zen/core/features/auth/actions';

export default async function AuthPage({ params, searchParams }) {
  const session = await getSession();
  
  return (
    <div className="min-h-screen flex items-center justify-center p-4 md:p-8">
      <div className="max-w-md w-full">
        <AuthPagesClient
          params={params}
          searchParams={searchParams}
          registerAction={registerAction}
          loginAction={loginAction}
          logoutAction={logoutAction}
          forgotPasswordAction={forgotPasswordAction}
          resetPasswordAction={resetPasswordAction}
          verifyEmailAction={verifyEmailAction}
          setSessionCookieAction={setSessionCookie}
          redirectAfterLogin={process.env.ZEN_AUTH_REDIRECT_AFTER_LOGIN || '/'}
          currentUser={session?.user || null}
        />
      </div>
    </div>
  );
}
