#pragma once

#include "shell/bar/widget.h"

#include <cstdint>

class Glyph;
class Label;
class PipeWireService;
struct wl_output;

class VolumeWidget : public Widget {
public:
  VolumeWidget(PipeWireService* audio, wl_output* output, bool showLabel);

  void create() override;

private:
  void doLayout(Renderer& renderer, float containerWidth, float containerHeight) override;
  void doUpdate(Renderer& renderer) override;
  void syncState(Renderer& renderer);

  PipeWireService* m_audio = nullptr;
  wl_output* m_output = nullptr;
  bool m_showLabel = true;
  Glyph* m_glyph = nullptr;
  Label* m_label = nullptr;
  float m_lastVolume = -1.0f;
  bool m_lastMuted = false;
  bool m_isVertical = false;
  bool m_lastVertical = false;
};
