import type { SafeUserProfile } from "@batch-cooking/shared";
import type { UserProfile } from "@prisma/client";

/**
 * Strips `passwordHash` off a Prisma `UserProfile` before it's ever sent to
 * a client. Shared by every module that hands a profile back to the
 * caller (`auth.service.ts`, `require-auth.ts`, `profile.service.ts`) —
 * previously duplicated inline in each, consolidated here so there's one
 * place this security-relevant stripping happens.
 */
export function toSafeProfile(profile: UserProfile): SafeUserProfile {
  const { passwordHash: _passwordHash, ...safeProfile } = profile;
  return safeProfile;
}
