import 'package:audioplayers/audioplayers.dart';
import 'package:vibration/vibration.dart';

class GameSoundService {
  static final AudioPlayer _audioPlayer = AudioPlayer();

  static Future<void> playCardFlipSound() async {
    try {
      // For now, we'll use vibration as a placeholder for the flip sound
      if (await Vibration.hasVibrator()) {
        Vibration.vibrate(duration: 100);
      }
    } catch (e) {
      // Handle error
    }
  }

  static Future<void> playSuccessSound() async {
    try {
      // Play success sound effect
      if (await Vibration.hasVibrator()) {
        Vibration.vibrate(pattern: [0, 200, 100, 200]);
      }
    } catch (e) {
      // Handle error
    }
  }

  static Future<void> playHintFoundSound() async {
    try {
      // Play hint discovery sound
      if (await Vibration.hasVibrator()) {
        Vibration.vibrate(duration: 150);
      }
    } catch (e) {
      // Handle error
    }
  }

  static Future<void> playPointsEarnedSound() async {
    try {
      // Play points earned sound with celebration vibration
      if (await Vibration.hasVibrator()) {
        Vibration.vibrate(pattern: [0, 100, 50, 100, 50, 200]);
      }
    } catch (e) {
      // Handle error
    }
  }

  static void dispose() {
    _audioPlayer.dispose();
  }
}
