#ifndef GOAP_STATE_HPP
#define GOAP_STATE_HPP

#include "actor_world_state.hpp"
#include <godot_cpp/classes/node.hpp>
#include <godot_cpp/classes/node3d.hpp>

namespace gd = godot;

namespace goap {
class Action;

class State : public gd::Node {
friend class Action;
    GDCLASS(State, gd::Node);
    static void _bind_methods();
public:
    virtual void _enter_tree() override;
    virtual void _process(double) override;
    void interrupt_state();
    void end_state();
    Action const *get_action() const;
    //! \returns True if the Action's requirements are complete. Without evaluating Action::require_state_complete.
    bool is_action_done() const;
    //! \returns True if the Action's requirements are complete. Including Action::require_state_complete.
    bool is_action_done_interrupt() const;
protected:
    virtual void _end_state();
private:
    ActorWorldState *world_state{nullptr};
    Action const *action{nullptr};
};
}

#endif // !GOAP_STATE_HPP
