#ifndef IYGRABBAGSTATUS_H
#define IYGRABBAGSTATUS_H

#include <string>
#include <functional>
#include <vector>
#include <QImage>

// 工作状态枚举
enum class WorkStatus {
    Ready,           // 准备就绪
    Working,         // 正在工作
    Completed,       // 监测完成
    Error            // 设备异常
};

// 工作状态转换为字符串的工具函数
inline std::string WorkStatusToString(WorkStatus status) {
    switch (status) {
        case WorkStatus::Ready:     return "准备就绪";
        case WorkStatus::Working:   return "正在工作";
        case WorkStatus::Completed: return "检测完成";
        case WorkStatus::Error:     return "设备异常";
        default:                    return "未知状态";
    }
}

// 坐标结构体
struct GrabBagPosition {
    double x;
    double y;
    double z;
    double roll;
    double pitch;
    double yaw;
};

struct GrabBagPositionLayout {
    int layerIndex;
    std::vector<GrabBagPosition> position;
};

// 检测结果结构体
struct DetectionResult {
    QImage image;
    std::vector<GrabBagPositionLayout> positionLayout;
};

// 状态回调接口
class IYGrabBagStatus {
public:
    virtual ~IYGrabBagStatus() = default;

    // 状态文字回调
    virtual void OnStatusUpdate(const std::string& statusMessage) = 0;
    
    // 算法监测结果回调
    virtual void OnDetectionResult(const DetectionResult& result) = 0;
    
    // 相机状态回调
    virtual void OnCamera1StatusChanged(bool isConnected) = 0;
    virtual void OnCamera2StatusChanged(bool isConnected) = 0;
    
    // 机械臂连接状态回调
    virtual void OnRobotConnectionChanged(bool isConnected) = 0;

    // 相机个数回调
    virtual void OnCameraCountChanged(int cameraCount) = 0;
    
    // 工作状态回调
    virtual void OnWorkStatusChanged(WorkStatus status) = 0;
};

#endif // IYGRABBAGSTATUS_H
