/**
 * Solar icon variants supported by the @iconify-json/solar collection
 */
export type SolarIconVariant = 'linear' | 'bold' | 'outline' | 'broken' | 'bold-duotone' | 'line-duotone'

/**
 * Generates a Solar icon name with the configured variant
 *
 * This composable creates Solar icon references that automatically use the variant
 * configured in nuxt.config.ts (or overridden via NUXT_PUBLIC_SOLAR_ICON_VARIANT env var).
 *
 * @param iconName - The base Solar icon name (e.g., 'calendar', 'user', 'settings')
 * @param variant - Optional variant override. If not provided, uses config.public.solarIconVariant
 * @returns Full icon reference for use with UIcon (e.g., 'i-solar-calendar-line-duotone')
 *
 * @example
 * // Uses configured variant (default: 'line-duotone')
 * const icon = useSolarIcon('calendar')
 * // Returns: 'i-solar-calendar-line-duotone'
 *
 * @example
 * // Override variant for specific icon
 * const icon = useSolarIcon('user', 'bold')
 * // Returns: 'i-solar-user-bold'
 *
 * @example
 * // Usage in template
 * <UIcon :name="useSolarIcon('settings')" />
 */
export function useSolarIcon(
  iconName: string,
  variant?: SolarIconVariant
): string {
  const appConfig = useAppConfig()
  const iconVariant = variant || appConfig.saas.ui!.solarIconVariant

  return `i-solar-${iconName}-${iconVariant as SolarIconVariant}`
}
