#pragma once
#include <behaviortree_cpp_v3/action_node.h>
#include <iostream>
#include <thread>
#include <chrono>

// 1. 假装连接车端并夺权
class MockConnectAGV : public BT::SyncActionNode {
public:
    MockConnectAGV(const std::string& name) : BT::SyncActionNode(name, {}) {}
    BT::NodeStatus tick() override {
        std::cout << "💻 [gRPC 对外] 📡 正在连接 Windows 车端... 夺权成功！" << std::endl;
        std::this_thread::sleep_for(std::chrono::milliseconds(500)); // 假装网络耗时 0.5 秒
        return BT::NodeStatus::SUCCESS;
    }
};

// 2. 假装呼叫底盘算法
class MockCallChassisAlgo : public BT::SyncActionNode {
public:
    MockCallChassisAlgo(const std::string& name) : BT::SyncActionNode(name, {}) {}
    BT::NodeStatus tick() override {
        std::cout << "🧮 [Action 对内] 🚙 丢给底盘算法团队... 算好了！左轮径 0.098m。" << std::endl;
        std::this_thread::sleep_for(std::chrono::milliseconds(800));
        return BT::NodeStatus::SUCCESS;
    }
};

// 3. 假装控制车子跑S型曲线
class MockTuneControl : public BT::SyncActionNode {
public:
    MockTuneControl(const std::string& name) : BT::SyncActionNode(name, {}) {}
    BT::NodeStatus tick() override {
        std::cout << "💻 [gRPC 对外] 📈 正在下发S型曲线测试考题... 车端已跑完。" << std::endl;
        std::this_thread::sleep_for(std::chrono::milliseconds(500));
        return BT::NodeStatus::SUCCESS;
    }
};

// 4. 假装呼叫AI寻优算法
class MockCallControlAlgo : public BT::SyncActionNode {
public:
    MockCallControlAlgo(const std::string& name) : BT::SyncActionNode(name, {}) {}
    BT::NodeStatus tick() override {
        std::cout << "🧮 [Action 对内] 🧠 AI贝叶斯打分完毕... PID 最优参数已锁定！" << std::endl;
        std::this_thread::sleep_for(std::chrono::milliseconds(800));
        return BT::NodeStatus::SUCCESS;
    }
};

// 5. 假装走停拍并下载大文件
class MockMoveAndCapture : public BT::SyncActionNode {
public:
    MockMoveAndCapture(const std::string& name) : BT::SyncActionNode(name, {}) {}
    BT::NodeStatus tick() override {
        std::cout << "💻 [gRPC 对外] 🛑 刹车静止...咔嚓！5MB大文件已下载至 /tmp/cam.png" << std::endl;
        std::this_thread::sleep_for(std::chrono::milliseconds(800));
        return BT::NodeStatus::SUCCESS;
    }
};

// 6. 假装调用外参标定视觉算法
class MockCallSensorAlgo : public BT::SyncActionNode {
public:
    MockCallSensorAlgo(const std::string& name) : BT::SyncActionNode(name, {}) {}
    BT::NodeStatus tick() override {
        std::cout << "🧮 [Action 对内] 📷 视觉团队正在算矩阵... 拿到 4x4 外参矩阵！" << std::endl;
        std::this_thread::sleep_for(std::chrono::milliseconds(800));
        return BT::NodeStatus::SUCCESS;
    }
};

// 7. 假装出厂固化
class MockCommitAllParams : public BT::SyncActionNode {
public:
    MockCommitAllParams(const std::string& name) : BT::SyncActionNode(name, {}) {}
    BT::NodeStatus tick() override {
        std::cout << "💻 [gRPC 对外] 💾 正在把所有完美参数烧录进 AGV... 标定闭环，可以出厂！\n" << std::endl;
        std::this_thread::sleep_for(std::chrono::milliseconds(300));
        return BT::NodeStatus::SUCCESS;
    }
};