syntax = "proto3";
option go_package = "./pb";

package pb;
import "models/model_monitor_node.proto";
import "models/rpc_messages.proto";

service MonitorNodeService {
	// 创建监控节点
	rpc createMonitorNode (CreateMonitorNodeRequest) returns (CreateMonitorNodeResponse);

	// 修改监控节点
	rpc updateMonitorNode (UpdateMonitorNodeRequest) returns (RPCSuccess);

	// 删除监控节点
	rpc deleteMonitorNode (DeleteMonitorNodeRequest) returns (RPCSuccess);

	// 列出所有可用监控节点
	rpc findAllEnabledMonitorNodes (FindAllEnabledMonitorNodesRequest) returns (FindAllEnabledMonitorNodesResponse);

	// 计算监控节点数量
	rpc countAllEnabledMonitorNodes (CountAllEnabledMonitorNodesRequest) returns (RPCCountResponse);

	// 列出单页的监控节点
	rpc listEnabledMonitorNodes (ListEnabledMonitorNodesRequest) returns (ListEnabledMonitorNodesResponse);

	// 根据ID查找节点
	rpc findEnabledMonitorNode (FindEnabledMonitorNodeRequest) returns (FindEnabledMonitorNodeResponse);

	// 获取当前监控节点信息
	rpc findCurrentMonitorNode (FindCurrentMonitorNodeRequest) returns (FindCurrentMonitorNodeResponse);

	// 更新节点状态
	rpc updateMonitorNodeStatus (UpdateMonitorNodeStatusRequest) returns (RPCSuccess);
}

// 创建监控节点
message CreateMonitorNodeRequest {
	string name = 1;
	string description = 2;
	bool isOn = 3;
}

message CreateMonitorNodeResponse {
	int64 nodeId = 1;
}

// 修改监控节点
message UpdateMonitorNodeRequest {
	int64 nodeId = 1;
	string name = 2;
	string description = 3;
	bool isOn = 4;
}

// 删除监控节点
message DeleteMonitorNodeRequest {
	int64 nodeId = 1;
}

// 列出所有可用监控节点
message FindAllEnabledMonitorNodesRequest {

}

message FindAllEnabledMonitorNodesResponse {
	repeated MonitorNode nodes = 1;
}

// 计算监控节点数量
message CountAllEnabledMonitorNodesRequest {

}

// 列出单页的监控节点
message ListEnabledMonitorNodesRequest {
	int64 offset = 1;
	int64 size = 2;
}

message ListEnabledMonitorNodesResponse {
	repeated MonitorNode nodes = 1;
}

// 根据ID查找节点
message FindEnabledMonitorNodeRequest {
	int64 nodeId = 1;
}

message FindEnabledMonitorNodeResponse {
	MonitorNode node = 1;
}

// 获取当前监控节点
message FindCurrentMonitorNodeRequest {

}

message FindCurrentMonitorNodeResponse {
	MonitorNode node = 1;
}

// 更新监控状态
message UpdateMonitorNodeStatusRequest {
	int64 nodeId = 1;
	bytes statusJSON = 2;
}