#pragma once

#include <string>
#include <vector>
#include <cstdint>

/**
 * @brief Abstract interface for audio system operations
 * 
 * Provides a common interface for audio playback, enabling
 * dependency injection and easier testing.
 */
class IAudioSystem {
public:
    virtual ~IAudioSystem() = default;
    
    /**
     * @brief Play a sound effect
     * @param name Sound effect name/identifier
     */
    virtual void playSound(const std::string& name) = 0;
    
    /**
     * @brief Play background music
     * @param name Music track name/identifier
     */
    virtual void playMusic(const std::string& name) = 0;
    
    /**
     * @brief Stop currently playing music
     */
    virtual void stopMusic() = 0;
    
    /**
     * @brief Set master volume for all audio
     * @param volume Volume level (0.0 to 1.0)
     */
    virtual void setMasterVolume(float volume) = 0;
    
    /**
     * @brief Set music volume
     * @param volume Volume level (0.0 to 1.0)
     */
    virtual void setMusicVolume(float volume) = 0;
    
    /**
     * @brief Set sound effects volume
     * @param volume Volume level (0.0 to 1.0)
     */
    virtual void setSoundVolume(float volume) = 0;
    
    /**
     * @brief Check if music is currently playing
     * @return true if music is playing, false otherwise
     */
    virtual bool isMusicPlaying() const = 0;

    // Extended control methods used by the application
    virtual bool init() = 0;
    virtual void shutdown() = 0;

    virtual void addTrack(const std::string& path) = 0;
    virtual void addTrackAsync(const std::string& path) = 0;
    virtual void startBackgroundLoading() = 0;
    virtual bool isLoadingComplete() const = 0;
    virtual int getLoadedTrackCount() const = 0;

    virtual void start() = 0;
    virtual void skipToNextTrack() = 0;
    virtual void shuffle() = 0;

    virtual void toggleMute() = 0;
    virtual bool isMuted() const = 0;

    virtual void setMenuTrack(const std::string& path) = 0;
    virtual void playMenuMusic() = 0;
    virtual void playGameMusic() = 0;

    // Low-level SFX path (raw PCM) used by internal SFX mixer
    virtual void playSfx(const std::vector<int16_t>& pcm, int channels, int rate, float volume) = 0;
};
