import 'package:wolf_3d_dart/wolf_3d_data_types.dart';
import 'package:wolf_3d_dart/wolf_3d_engine.dart';
import 'package:wolf_3d_flutter/wolf_3d_flutter.dart';

class FlutterAudioAdapter implements EngineAudio {
  final Wolf3d wolf3d;

  FlutterAudioAdapter(this.wolf3d);

  @override
  void playLevelMusic(Music music) {
    wolf3d.audio.playLevelMusic(music);
  }

  @override
  void stopMusic() {
    wolf3d.audio.stopMusic();
  }

  @override
  Future<void> stopAllAudio() async {
    await wolf3d.audio.stopAllAudio();
  }

  @override
  void playSoundEffect(SoundEffect effect) {
    wolf3d.audio.playSoundEffect(effect);
  }

  @override
  void playSoundEffectId(int sfxId) {
    wolf3d.audio.playSoundEffectId(sfxId);
  }

  @override
  void playMenuMusic() {
    wolf3d.audio.playMenuMusic();
  }

  @override
  Future<void> init() async {
    await wolf3d.audio.init();
  }

  @override
  void dispose() {
    wolf3d.audio.dispose();
  }

  @override
  Future<void> debugSoundTest() async {
    wolf3d.audio.debugSoundTest();
  }

  @override
  WolfensteinData? get activeGame => wolf3d.maybeActiveGame;

  @override
  set activeGame(WolfensteinData? value) {
    if (value != null) {
      wolf3d.setActiveGame(value);
    }
  }
}
