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

package pb;

import "models/rpc_messages.proto";
import "models/model_node_log.proto";

// 节点日志相关服务
service NodeLogService {
	// 创建日志
	rpc createNodeLogs (CreateNodeLogsRequest) returns (CreateNodeLogsResponse);

	// 查询日志数量
	rpc countNodeLogs (CountNodeLogsRequest) returns (RPCCountResponse);

	// 列出单页日志
	rpc listNodeLogs (ListNodeLogsRequest) returns (ListNodeLogsResponse);

	// 设置日志为已修复
	rpc fixNodeLog (FixNodeLogRequest) returns (RPCSuccess);

	// 计算未读的日志数量
	rpc countAllUnreadNodeLogs(CountAllUnreadNodeLogsRequest) returns (RPCCountResponse);

	// 设置日志为已读
	rpc updateNodeLogsRead(UpdateNodeLogsReadRequest) returns (RPCSuccess);
}

// 创建日志
message CreateNodeLogsRequest {
	repeated NodeLog nodeLogs = 1;
}

message CreateNodeLogsResponse {

}

// 查询日志数量
message CountNodeLogsRequest {
	int64 nodeId = 1;
	string role = 2;
	string dayFrom = 3;
	string dayTo = 4;
	string keyword = 5;
	string level = 6;
	int64 serverId = 7;
	int64 originId = 8;
	bool isUnread = 9;
}

// 列出单页日志
message ListNodeLogsRequest {
	int64 nodeId = 1;
	string role = 2;
	int64 offset = 3;
	int64 size = 4;

	string dayFrom = 5;
	string dayTo = 6;
	string keyword = 7;
	string level = 8;
	int64 serverId = 9;
	int32 fixedState = 10;
	bool allServers = 11; // 是否获取所有服务相关的日志
	int64 originId = 12;
	bool isUnread = 13;
}

message ListNodeLogsResponse {
	repeated NodeLog nodeLogs = 1;
}

// 设置日志为已修复
message FixNodeLogRequest {
	int64 nodeLogId = 1;
}

// 计算未读的日志数量
message CountAllUnreadNodeLogsRequest {
}

// 设置日志为已读
message UpdateNodeLogsReadRequest {
	repeated int64 nodeLogIds = 1;
}