import { ProfilePageQuery } from '@/lib/page-queries/ProfilePageQuery';
import { notFound } from 'next/navigation';
import { updateProfileAction } from '@/app/actions/profileActions';
import { ProfileSettingsPageClient } from '@/client-wrapper/ProfileSettingsPageClient';

export default async function ProfileSettingsPage() {
  const query = new ProfilePageQuery();
  const result = await query.execute();

  if (result.isErr()) {
    notFound();
  }

  const viewData = result.unwrap();

  return (
    <ProfileSettingsPageClient
      viewData={viewData}
      onSave={updateProfileAction}
    />
  );
}
