import { getDefaultProfileImage } from "@/lib/helpers";

const asset = (path: string) => `/assets/${path}`;

/**
 * The avatar for a permissions row: their own photo, or the gendered placeholder.
 *
 * Shared by the holders list and the candidate picker, which render the same
 * person from two differently-shaped endpoints.
 */
export const permissionRowAvatar = (row: {
  pic: string;
  genderEn: string;
}): string =>
  row.pic ||
  getDefaultProfileImage(
    row.genderEn,
    asset("profile/male_profile.svg"),
    asset("profile/female_profile.svg"),
    asset("profile/org_profile.svg")
  );
