#pragma once

#include "esphome/components/button/button.h"
#include "esphome/core/automation.h"
#include "esphome/core/component.h"

namespace esphome::button {

template<typename... Ts> class PressAction final : public Action<Ts...> {
 public:
  explicit PressAction(Button *button) : button_(button) {}

  void play(const Ts &...x) override { this->button_->press(); }

 protected:
  Button *button_;
};

class ButtonPressTrigger final : public Trigger<> {
 public:
  ButtonPressTrigger(Button *button) {
    button->add_on_press_callback([this]() { this->trigger(); });
  }
};

}  // namespace esphome::button
