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 fixNodeLogs (FixNodeLogsRequest) returns (RPCSuccess);

	// 设置所有日志为已修复
	rpc fixAllNodeLogs (FixAllNodeLogsRequest) returns (RPCSuccess);

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

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

	// 设置所有日志未已读
	rpc updateAllNodeLogsRead(UpdateAllNodeLogsReadRequest) returns (RPCSuccess);

	// 删除日志
	rpc deleteNodeLogs(DeleteNodeLogsRequest) returns (RPCSuccess);
}

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

message CreateNodeLogsResponse {

}

// 查询日志数量
message CountNodeLogsRequest {
	int64 nodeClusterId = 11;
	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;
	string tag = 10;
	int32 fixedState = 12;
	bool allServers = 13; // 是否获取所有服务相关的日志
}

// 列出单页日志
message ListNodeLogsRequest {
	int64 nodeClusterId = 15;
	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;
	string tag = 14;
}

message ListNodeLogsResponse {
	repeated NodeLog nodeLogs = 1;
}

// 设置日志为已修复
message FixNodeLogsRequest {
	repeated int64 nodeLogIds = 1;
}

// 设置所有日志为已修复
message FixAllNodeLogsRequest {

}

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

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

	int64 nodeId = 2;
	string role = 3;
}

// 设置所有日志未已读
message UpdateAllNodeLogsReadRequest {

}

// 删除日志
message DeleteNodeLogsRequest {
	int64 nodeClusterId = 15;
	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;
	string tag = 14;
}