import { db, users, eq } from "@epicure/db";

export async function getUserPrivateBio(userId: string): Promise<string | null> {
  const row = await db.query.users.findFirst({
    where: eq(users.id, userId),
    columns: { privateBio: true },
  });
  return row?.privateBio ?? null;
}

export function buildUserBioContext(privateBio: string | null): string {
  if (!privateBio?.trim()) return "";
  return `\n\nUser preferences and context:\n${privateBio.trim()}`;
}
