#ifndef ABNORMAL_LOG_H
#define ABNORMAL_LOG_H
#include "../tag.h"
// 异常检测点结构体
typedef struct
{
    char *tag_name;      // 标签名称
    char *device_name;   // 设备名称
    char *device_type;   // 设备类型
    int property;        // 属性类型（使用PROPERTY_TYPE枚举）
    char *rule;          // 检测规则
    char *description;   // 描述信息
    int report_count;    //上报次数
    bool is_special_rule;//是否为特殊规则，跳过tag，直接以数据类型匹配的都为特殊规则
} abnormal_point_t;

// 从JSON字符串解析异常检测点
abnormal_point_t **parse_abnormal_points_from_json(const char *json_str, int *point_count);

// 释放异常检测点内存
void free_abnormal_points(abnormal_point_t **points, int point_count);

// 异常日志初始化
int abnormal_log_init(void);

// 异常日志匹配记录
int abnormal_log_match_record(tag_t **tag, int taglen, unsigned char *send_rawdata,int send_rawdatalen, char *recv_rawdata, int recv_rawdata_len);

// 异常日志清理
int abnormal_log_cleanup(void);

#endif