#pragma once

#ifdef YOLO_EXPORTS
#define YOLO_API __declspec(dllexport)
#else
#define YOLO_API __declspec(dllimport)
#endif

#include <vector>

struct Detection
{
    int class_id;
    float score;
    int x;
    int y;
    int width;
    int height;
};

extern "C" {
    YOLO_API int perform_detection(
        const wchar_t* model_path,
        unsigned char* image_bytes,
        int image_width,
        int image_height,
        Detection** out_detections,
        int* out_detections_count,
        const char** class_names,
        int class_names_count,
        float conf_threshold,   // 置信度阈值 (例如 0.5f)
        float iou_threshold,    // NMS的IOU阈值 (例如 0.5f)
        int input_width,        // 模型输入宽度 (例如 640)
        int input_height        // 模型输入高度 (例如 640)
    );

    YOLO_API void free_memory(Detection* detections);

    YOLO_API void draw_and_encode_image(
        unsigned char* image_bytes,
        int image_width,
        int image_height,
        const Detection* detections,
        int detections_count,
        const char** class_names,
        int class_names_count,
        unsigned char** out_image_bytes,
        int* out_image_size
    );

    YOLO_API void free_image_memory(unsigned char* image_bytes);
}