#pragma once

#include "micro_wake_word.h"
#include "streaming_model.h"

#ifdef USE_ESP32

namespace esphome::micro_wake_word {

template<typename... Ts> class StartAction final : public Action<Ts...>, public Parented<MicroWakeWord> {
 public:
  void play(const Ts &...x) override { this->parent_->start(); }
};

template<typename... Ts> class StopAction final : public Action<Ts...>, public Parented<MicroWakeWord> {
 public:
  void play(const Ts &...x) override { this->parent_->stop(); }
};

template<typename... Ts> class IsRunningCondition final : public Condition<Ts...>, public Parented<MicroWakeWord> {
 public:
  bool check(const Ts &...x) override { return this->parent_->is_running(); }
};

template<typename... Ts> class EnableModelAction final : public Action<Ts...> {
 public:
  explicit EnableModelAction(WakeWordModel *wake_word_model) : wake_word_model_(wake_word_model) {}
  void play(const Ts &...x) override { this->wake_word_model_->enable(); }

 protected:
  WakeWordModel *wake_word_model_;
};

template<typename... Ts> class DisableModelAction final : public Action<Ts...> {
 public:
  explicit DisableModelAction(WakeWordModel *wake_word_model) : wake_word_model_(wake_word_model) {}
  void play(const Ts &...x) override { this->wake_word_model_->disable(); }

 protected:
  WakeWordModel *wake_word_model_;
};

template<typename... Ts> class ModelIsEnabledCondition final : public Condition<Ts...> {
 public:
  explicit ModelIsEnabledCondition(WakeWordModel *wake_word_model) : wake_word_model_(wake_word_model) {}
  bool check(const Ts &...x) override { return this->wake_word_model_->is_enabled(); }

 protected:
  WakeWordModel *wake_word_model_;
};

}  // namespace esphome::micro_wake_word

#endif
