//
// Created by bastian on 26.03.22.
//

#ifndef BUILD_ACTORANIMATION_H
#define BUILD_ACTORANIMATION_H

#include <behaviortree_cpp_v3/action_node.h>
#include <behaviortree_cpp_v3/basic_types.h>
#include <rclcpp/rclcpp.hpp>
#include <rclcpp_action/rclcpp_action.hpp>
#include <rclcpp_action/client_goal_handle.hpp>
#include <geometry_msgs/msg/pose.hpp>
#include <ros_actor_action_server_msgs/action/animation.hpp>
#include <memory>
#include <cstdlib>

using Animation = ros_actor_action_server_msgs::action::Animation;
using namespace rclcpp_action;

class ActorAnimation : public BT::StatefulActionNode {
    public:
        ActorAnimation(const std::string &name, const BT::NodeConfiguration &config, std::shared_ptr<rclcpp::Node> node, const std::string &actionName);

        static BT::PortsList providedPorts();

        BT::NodeStatus onStart() override;

        BT::NodeStatus onRunning() override;

        void onHalted() override;

    private:
        BT::NodeStatus result;
        std::mutex mutex;
        std::shared_ptr<Client<Animation>> client;
};


#endif //BUILD_ACTORANIMATION_H
