// Font utility functions

/**
 * Generate Google Fonts import URL for a list of fonts
 */
export const generateGoogleFontsImport = (fonts: string[]): string => {
  const familyParams = fonts
    .map(f => `family=${encodeURIComponent(f)}:wght@400;500;600;700`)
    .join('&');
  return `https://fonts.googleapis.com/css2?${familyParams}&display=swap`;
};

/**
 * Extract unique fonts from a style's word config
 */
export const extractFontsFromStyle = (wordConfig: {
  heading1: { font: string };
  heading2: { font: string };
  body: { font: string };
}): string[] => {
  return Array.from(new Set([
    wordConfig.heading1.font,
    wordConfig.heading2.font,
    wordConfig.body.font
  ])).filter(Boolean);
};

/**
 * Check if a font is available system-wide
 */
export const isSystemFont = (font: string): boolean => {
  const systemFonts = ['Arial', 'Georgia', 'Times New Roman', 'Courier New', 'Verdana'];
  return systemFonts.includes(font);
};
