import { SITE_URL } from "@/config/constants";

import { toKebabCase } from "./string";

export const FILE_EXTENSIONS = {
  img: ["jpg"],
  audio: ["webm", "mp3"],
} as const;

export function buildStaticAssetPath(
  fileName: string,
  assetType: "img",
): string;

export function buildStaticAssetPath(
  fileName: string,
  assetType: "audio",
): string[];

export function buildStaticAssetPath(
  fileName: string,
  assetType: keyof typeof FILE_EXTENSIONS,
) {
  const filePath = `/${assetType}/${toKebabCase(fileName)}`;
  const extensions = FILE_EXTENSIONS[assetType];

  if (extensions.length === 1) {
    return filePath + "." + extensions[0];
  } else {
    return extensions.map((ext) => filePath + "." + ext);
  }
}
