import { formatHoursMinutes } from "@/features/shared/clientReviewPolicy";

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

/**
 * The public-profile payload's `profile_data` block.
 *
 * Re-exported from `commonProfileTypes`, which transcribes
 * `WebsitePublicProfileResource`. This file held a third copy of the shape and
 * it was the least accurate of the three: `interest_display` was `string[]`
 * where the resource emits an array of **choice objects**
 * (`masterChoiceCollection()`), the four counters were `number` where every
 * one of them goes through `ar_num()` and is a *string* under an Arabic
 * locale, and it declared a `field_of_experience` key that appears nowhere in
 * the backend — the resource's field is `experience`.
 *
 * Nothing read either of those two keys, so this is a correction to the type
 * only.
 */
export type { ProfileData } from "./commonProfileTypes";

export /**
 * Backend sends decimal hours (7.5); the design shows them verbatim rather than
 * converting the fraction to minutes.
 */
const convertDecimalHoursToDisplay = (
  decimalHours: number | string | null | undefined
): string => {
  if (decimalHours === null || decimalHours === undefined) {
    return "0:00";
  }
  return formatHoursMinutes(decimalHours);
};
export { badgeImage } from "./commonProfileTypes";
