#pragma once

#include "Component.h"
#include <cstdint>
#include <yaml-cpp/yaml.h>

class AudioPlayerComponent : public Component {
public:
    AudioPlayerComponent(Object* owner);
    ~AudioPlayerComponent() override {}

    void SetAudio(uint64_t uaid);
    void Play();
    void Pause();
    void Stop();

    void SetLooping(bool value);
    void SetVolume(float vol);


    uint64_t GetUAID() const { return m_UAID; }

    void Update();

    // No longer used:
    bool IsPlaying() const  { return false; }
    std::string GetName() const override { return "AudioPlayerComponent"; }

    void Save(YAML::Emitter& out) const override;
    void Load(const YAML::Node& node)   override;

private:
    uint64_t m_UAID = 0;
    float    volume = 1.0f;
    bool     loop   = false;
};
