import { Platform } from 'react-native';

export const triggerHaptic = async (type: 'light' | 'medium' | 'success' | 'selection' = 'light') => {
  if (Platform.OS === 'web') return;
  try {
    const Haptics = await import('expo-haptics');
    switch (type) {
      case 'light':
        await Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light);
        break;
      case 'medium':
        await Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Medium);
        break;
      case 'success':
        await Haptics.notificationAsync(Haptics.NotificationFeedbackType.Success);
        break;
      case 'selection':
        await Haptics.selectionAsync();
        break;
    }
  } catch {}
};
