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

package pb;

import "models/model_node.proto";
import "models/model_node_login.proto";
import "models/model_node_install_status.proto";
import "models/model_dns_route.proto";
import "models/model_size_capacity.proto";
import "models/model_node_cluster.proto";
import "models/model_node_region.proto";
import "models/rpc_messages.proto";

// 边缘节点管理服务
service NodeService {
	// 创建节点
	rpc createNode (CreateNodeRequest) returns (CreateNodeResponse);

	// 注册集群节点
	rpc registerClusterNode (RegisterClusterNodeRequest) returns (RegisterClusterNodeResponse);

	// 所有可用的节点数量
	rpc countAllEnabledNodes (CountAllEnabledNodesRequest) returns (RPCCountResponse);

	// 计算匹配的节点数量
	rpc countAllEnabledNodesMatch (CountAllEnabledNodesMatchRequest) returns (RPCCountResponse);

	// 列出单页节点
	rpc listEnabledNodesMatch (ListEnabledNodesMatchRequest) returns (ListEnabledNodesMatchResponse);

	// 根据集群查找所有节点
	rpc findAllEnabledNodesWithNodeClusterId (FindAllEnabledNodesWithNodeClusterIdRequest) returns (FindAllEnabledNodesWithNodeClusterIdResponse);

	// 删除节点
	rpc deleteNode (DeleteNodeRequest) returns (RPCSuccess);

	// 从集群中删除节点
	rpc deleteNodeFromNodeCluster (DeleteNodeFromNodeClusterRequest) returns (RPCSuccess);

	// 修改节点
	rpc updateNode (UpdateNodeRequest) returns (RPCSuccess);

	// 获取单个节点信息
	rpc findEnabledNode (FindEnabledNodeRequest) returns (FindEnabledNodeResponse);

	// 获取单个节点基本信息
	rpc findEnabledBasicNode (FindEnabledBasicNodeRequest) returns (FindEnabledBasicNodeResponse);

	// 获取当前节点配置
	rpc findCurrentNodeConfig (FindCurrentNodeConfigRequest) returns (FindCurrentNodeConfigResponse);

	// 节点stream
	rpc nodeStream (stream NodeStreamMessage) returns (stream NodeStreamMessage);

	// 向节点发送命令
	rpc sendCommandToNode (NodeStreamMessage) returns (NodeStreamMessage);

	// 更新节点状态
	rpc updateNodeStatus (UpdateNodeStatusRequest) returns (RPCSuccess);

	// 修改节点安装状态
	rpc updateNodeIsInstalled (UpdateNodeIsInstalledRequest) returns (RPCSuccess);

	// 安装节点
	rpc installNode (InstallNodeRequest) returns (InstallNodeResponse);

	// 升级节点
	rpc upgradeNode (UpgradeNodeRequest) returns (UpgradeNodeResponse);

	// 启动节点
	rpc startNode (StartNodeRequest) returns (StartNodeResponse);

	// 停止节点
	rpc stopNode (StopNodeRequest) returns (StopNodeResponse);

	// 更改节点连接的API节点信息
	rpc updateNodeConnectedAPINodes (UpdateNodeConnectedAPINodesRequest) returns (RPCSuccess);

	// 计算使用某个认证的节点数量
	rpc countAllEnabledNodesWithNodeGrantId (CountAllEnabledNodesWithNodeGrantIdRequest) returns (RPCCountResponse);

	// 查找使用某个认证的所有节点
	rpc findAllEnabledNodesWithNodeGrantId (FindAllEnabledNodesWithNodeGrantIdRequest) returns (FindAllEnabledNodesWithNodeGrantIdResponse);

	// 计算没有安装的节点数量
	rpc countAllNotInstalledNodesWithNodeClusterId (CountAllNotInstalledNodesWithNodeClusterIdRequest) returns (RPCCountResponse);

	// 列出所有未安装的节点
	rpc findAllNotInstalledNodesWithNodeClusterId (FindAllNotInstalledNodesWithNodeClusterIdRequest) returns (FindAllNotInstalledNodesWithNodeClusterIdResponse);

	// 计算需要升级的节点数量
	rpc countAllUpgradeNodesWithNodeClusterId (CountAllUpgradeNodesWithNodeClusterIdRequest) returns (RPCCountResponse);

	// 列出所有需要升级的节点
	rpc findAllUpgradeNodesWithNodeClusterId (FindAllUpgradeNodesWithNodeClusterIdRequest) returns (FindAllUpgradeNodesWithNodeClusterIdResponse);

	// 读取节点安装状态
	rpc findNodeInstallStatus (FindNodeInstallStatusRequest) returns (FindNodeInstallStatusResponse);

	// 修改节点登录信息
	rpc updateNodeLogin (UpdateNodeLoginRequest) returns (RPCSuccess);

	// 计算某个节点分组内的节点数量
	rpc countAllEnabledNodesWithNodeGroupId (CountAllEnabledNodesWithNodeGroupIdRequest) returns (RPCCountResponse);

	// 取得某个集群下的所有节点DNS信息
	rpc findAllEnabledNodesDNSWithNodeClusterId (FindAllEnabledNodesDNSWithNodeClusterIdRequest) returns (FindAllEnabledNodesDNSWithNodeClusterIdResponse);

	// 查找单个节点的域名解析信息
	rpc findEnabledNodeDNS (FindEnabledNodeDNSRequest) returns (FindEnabledNodeDNSResponse);

	// 修改节点的DNS解析信息
	rpc updateNodeDNS (UpdateNodeDNSRequest) returns (RPCSuccess);

	// 计算某个区域下的节点数量
	rpc countAllEnabledNodesWithNodeRegionId (CountAllEnabledNodesWithNodeRegionIdRequest) returns (RPCCountResponse);

	// 根据一组ID获取节点信息
	rpc findEnabledNodesWithIds (FindEnabledNodesWithIdsRequest) returns (FindEnabledNodesWithIdsResponse);

	// 检查新版本
	rpc checkNodeLatestVersion (CheckNodeLatestVersionRequest) returns (CheckNodeLatestVersionResponse);

	// 设置节点上线状态
	rpc updateNodeUp (UpdateNodeUpRequest) returns (RPCSuccess);

	// 下载最新边缘节点安装文件
	rpc downloadNodeInstallationFile (DownloadNodeInstallationFileRequest) returns (DownloadNodeInstallationFileResponse);

	// 修改节点系统信息
	rpc updateNodeSystem(UpdateNodeSystemRequest) returns (RPCSuccess);

	// 修改节点缓存设置
	rpc updateNodeCache(UpdateNodeCacheRequest) returns (RPCSuccess);

	// 读取节点级别信息
	rpc findNodeLevelInfo(FindNodeLevelInfoRequest) returns (FindNodeLevelInfoResponse);

	// 读取节点DNS Resolver
	rpc findNodeDNSResolver(FindNodeDNSResolverRequest) returns (FindNodeDNSResolverResponse);

	// 修改DNS Resolver
	rpc updateNodeDNSResolver(UpdateNodeDNSResolverRequest) returns (RPCSuccess);

	// 获取节点的DDoS设置
	rpc findNodeDDoSProtection(FindNodeDDoSProtectionRequest) returns (FindNodeDDoSProtectionResponse);

	// 修改节点的DDoS设置
	rpc updateNodeDDoSProtection(UpdateNodeDDoSProtectionRequest) returns (RPCSuccess);

	// 取得节点的服务全局配置
	rpc findNodeGlobalServerConfig(FindNodeGlobalServerConfigRequest) returns (FindNodeGlobalServerConfigResponse);

	// 取得节点的配置概要信息
	rpc findEnabledNodeConfigInfo (FindEnabledNodeConfigInfoRequest) returns (FindEnabledNodeConfigInfoResponse);

	// 查找节点区域信息数量
	rpc countAllNodeRegionInfo(CountAllNodeRegionInfoRequest) returns (RPCCountResponse);

	// 列出单页节点区域信息
	rpc listNodeRegionInfo(ListNodeRegionInfoRequest) returns (ListNodeRegionInfoResponse);

	// 修改节点区域信息
	rpc updateNodeRegionInfo(UpdateNodeRegionInfoRequest) returns (RPCSuccess);

	// 查找单个节点的API相关配置
	rpc findNodeAPIConfig(FindNodeAPIConfigRequest) returns (FindNodeAPIConfigResponse);

	// 修改某个节点的API相关配置
	rpc updateNodeAPIConfig(UpdateNodeAPIConfigRequest) returns (RPCSuccess);

	// 查找节点的UAM策略
	rpc findNodeUAMPolicies(FindNodeUAMPoliciesRequest) returns (FindNodeUAMPoliciesResponse);

	// 查找节点的HTTP CC策略
	rpc findNodeHTTPCCPolicies(FindNodeHTTPCCPoliciesRequest) returns (FindNodeHTTPCCPoliciesResponse);

	// 查找节点的HTTP3策略
	rpc findNodeHTTP3Policies(FindNodeHTTP3PoliciesRequest) returns (FindNodeHTTP3PoliciesResponse);

	// 查找节点的自定义页面策略
	rpc findNodeHTTPPagesPolicies(FindNodeHTTPPagesPoliciesRequest) returns (FindNodeHTTPPagesPoliciesResponse);

	// 查找节点调度信息
	rpc findNodeScheduleInfo(FindNodeScheduleInfoRequest) returns (FindNodeScheduleInfoResponse);

	// 修改节点调度信息
	rpc updateNodeScheduleInfo(UpdateNodeScheduleInfoRequest) returns (RPCSuccess);

	// 重置节点动作状态
	rpc resetNodeActionStatus(ResetNodeActionStatusRequest) returns (RPCSuccess);

	// 查找集群的节点调度信息
	rpc findAllNodeScheduleInfoWithNodeClusterId(FindAllNodeScheduleInfoWithNodeClusterIdRequest) returns (FindAllNodeScheduleInfoWithNodeClusterIdResponse);

	// 复制动作设置到分组
	rpc copyNodeActionsToNodeGroup(CopyNodeActionsToNodeGroupRequest) returns (RPCSuccess);

	// 复制动作设置到集群
	rpc copyNodeActionsToNodeCluster(CopyNodeActionsToNodeClusterRequest) returns (RPCSuccess);

	// 查找节点的TOA配置
	rpc findNodeTOAConfig(FindNodeTOAConfigRequest) returns (FindNodeTOAConfigResponse);

	// 查找节点的网络安全策略
	rpc findNodeNetworkSecurityPolicy(FindNodeNetworkSecurityPolicyRequest) returns (FindNodeNetworkSecurityPolicyResponse);

	// 查找节点的WebP策略
	rpc findNodeWebPPolicies(FindNodeWebPPoliciesRequest) returns (FindNodeWebPPoliciesResponse);

	// 修改节点的启用状态
	rpc updateNodeIsOn(UpdateNodeIsOnRequest) returns (RPCSuccess);
}

// 创建节点
message CreateNodeRequest {
	string name = 1; // 节点名称
	int64 nodeClusterId = 2; // 节点所属集群
	NodeLogin nodeLogin = 3; // 节点登录信息
	int64 nodeGroupId = 4; // 节点所属分组
	int64 dnsDomainId = 5 [deprecated = true]; // 节点域名ID，此参数已过期，请不要再使用
	repeated string dnsRoutes = 6; // 节点DNS线路列表
	int64 nodeRegionId = 7; // 节点所属区域
}

message CreateNodeResponse {
	int64 nodeId = 1; // 节点ID
}

// 注册集群节点
message RegisterClusterNodeRequest {
	string name = 1;
}

message RegisterClusterNodeResponse {
	string uniqueId = 1;
	string secret = 2;
	repeated string endpoints = 3;
}

// 所有可用的节点数量
message CountAllEnabledNodesRequest {

}

// 列出单页节点
message ListEnabledNodesMatchRequest {
	int64 offset = 1; // 读取位置
	int64 size = 2; // 读取数量
	int64 nodeClusterId = 3; // 集群ID
	int32 installState = 4; // 安装状态
	int32 activeState = 5; // 在线状态
	string keyword = 6; // 关键词
	int64 nodeGroupId = 7; // 节点分组ID
	int64 nodeRegionId = 8; // 节点区域ID
	int32 level = 9; // 节点级别，目前只有1（L1）和2（L2）

	bool cpuAsc = 20;
	bool cpuDesc = 21;
	bool memoryAsc = 22;
	bool memoryDesc = 23;
	bool trafficInAsc = 24;
	bool trafficInDesc = 25;
	bool trafficOutAsc = 26;
	bool trafficOutDesc = 27;
	bool loadAsc = 28;
	bool loadDesc = 29;
	bool connectionsAsc = 30;
	bool connectionsDesc = 31;
}

message ListEnabledNodesMatchResponse {
	repeated Node nodes = 1;
}

// 根据集群查找所有节点
message FindAllEnabledNodesWithNodeClusterIdRequest {
	int64 nodeClusterId = 1; // 集群ID
	bool includeSecondary = 2; // 是否检查节点的从集群，如果为false，则只检查主集群ID
}

message FindAllEnabledNodesWithNodeClusterIdResponse {
	repeated Node nodes = 1;
}

// 删除节点
message DeleteNodeRequest {
	int64 nodeId = 1;
}

// 从集群中删除节点
message DeleteNodeFromNodeClusterRequest {
	int64 nodeId = 1;
	int64 nodeClusterId = 2;
}

// 修改节点
message UpdateNodeRequest {
	int64 nodeId = 1;
	string name = 2;
	int64 nodeClusterId = 3;
	repeated int64 secondaryNodeClusterIds = 13;
	bool isOn = 6;
	int64 nodeGroupId = 7;
	int64 nodeRegionId = 10;
	int32 level = 14;
	repeated string lnAddrs = 15; // Ln节点访问地址
	bool enableIPLists = 16; // 是否启用IP名单
}

// 获取单个节点信息
message FindEnabledNodeRequest {
	int64 nodeId = 1; // 节点ID
}

message FindEnabledNodeResponse {
	Node node = 1; // 节点信息
}

// 获取单个节点基本信息
message FindEnabledBasicNodeRequest {
	int64 nodeId = 1; // 节点ID
}

message FindEnabledBasicNodeResponse {
	BasicNode node = 1; // 节点基本信息
}

// 组合单个节点配置
message FindCurrentNodeConfigRequest {
	// 由于登录信息中已经包含了节点信息，所以这里不需要nodeId
	int64 version = 1;
	bool compress = 2; // 是否压缩
	int64 nodeTaskVersion = 3; // 通知任务版本
	bool useDataMap = 4; // 是否使用公共的数据集
}

message FindCurrentNodeConfigResponse {
	bytes nodeJSON = 1;
	bool isChanged = 2;
	bool isCompressed = 3;
	int64 dataSize = 4;
	int64 timestamp = 5;
}

// 节点stream
message NodeStreamMessage {
	int64 nodeId = 1;
	int64 requestId = 2;
	int32 timeoutSeconds = 3;
	string code = 4;
	bytes dataJSON = 5;
	bool isOk = 6;
	string message = 7;
}

// 更新节点状态
message UpdateNodeStatusRequest {
	int64 nodeId = 1;
	bytes statusJSON = 2;
}

// 计算匹配的节点数量
message CountAllEnabledNodesMatchRequest {
	int64 nodeClusterId = 1;
	int32 installState = 2;
	int32 activeState = 3;
	string keyword = 4;
	int64 nodeGroupId = 5;
	int64 nodeRegionId = 6;
	int32 level = 7;
}

// 修改节点安装状态
message UpdateNodeIsInstalledRequest {
	int64 nodeId = 1;
	bool isInstalled = 2;
}

// 安装节点
message InstallNodeRequest {
	int64 nodeId = 1;
}

message InstallNodeResponse {

}

// 升级节点
message UpgradeNodeRequest {
	int64 nodeId = 1;
}

message UpgradeNodeResponse {
}

// 启动节点
message StartNodeRequest {
	int64 nodeId = 1;
}

message StartNodeResponse {
	bool isOk = 1;
	string error = 2;
}

// 停止节点
message StopNodeRequest {
	int64 nodeId = 1;
}

message StopNodeResponse {
	bool isOk = 1;
	string error = 2;
}

// 更改节点连接的API节点信息
message UpdateNodeConnectedAPINodesRequest {
	repeated int64 apiNodeIds = 1;
}

// 计算使用某个认证的节点数量
message CountAllEnabledNodesWithNodeGrantIdRequest {
	int64 nodeGrantId = 1;
}

// 查找使用某个认证的所有节点
message FindAllEnabledNodesWithNodeGrantIdRequest {
	int64 nodeGrantId = 1;
}

message FindAllEnabledNodesWithNodeGrantIdResponse {
	repeated Node nodes = 1;
}

// 列出所有未安装的节点
message FindAllNotInstalledNodesWithNodeClusterIdRequest {
	int64 nodeClusterId = 1;
}

message FindAllNotInstalledNodesWithNodeClusterIdResponse {
	repeated Node nodes = 1;
}

// 计算未安装的节点数量
message CountAllNotInstalledNodesWithNodeClusterIdRequest {
	int64 nodeClusterId = 1;
}

// 计算需要升级的节点数量
message CountAllUpgradeNodesWithNodeClusterIdRequest {
	int64 nodeClusterId = 1;
}

// 列出所有需要升级的节点
message FindAllUpgradeNodesWithNodeClusterIdRequest {
	int64 nodeClusterId = 1;
}

message FindAllUpgradeNodesWithNodeClusterIdResponse {
	repeated NodeUpgrade nodes = 1;

	message NodeUpgrade {
		Node node = 1;
		string os = 2;
		string arch = 3;
		string oldVersion = 4;
		string newVersion = 5;
	}
}

// 读取节点安装状态
message FindNodeInstallStatusRequest {
	int64 nodeId = 1;
}

message FindNodeInstallStatusResponse {
	NodeInstallStatus installStatus = 1;
}

// 修改节点登录信息
message UpdateNodeLoginRequest {
	int64 nodeId = 1;
	NodeLogin nodeLogin = 2;
}

// 计算某个节点分组内的节点数量
message CountAllEnabledNodesWithNodeGroupIdRequest {
	int64 nodeGroupId = 1;
}

// 取得某个集群下的所有节点DNS信息
message FindAllEnabledNodesDNSWithNodeClusterIdRequest {
	int64 nodeClusterId = 1;
	bool isInstalled = 2;
}

message FindAllEnabledNodesDNSWithNodeClusterIdResponse {
	repeated NodeDNSInfo nodes = 1;
}

message NodeDNSInfo {
	int64 id = 1;
	string name = 2;
	string ipAddr = 3;
	int64 nodeIPAddressId = 9;
	repeated DNSRoute routes = 4;
	int64 nodeClusterId = 5;
	int64 dnsDomainId = 6;
	string dnsDomainName = 7;
	string nodeClusterDNSName = 8;
	bool isBackupForCluster = 10; // 是否为集群备份节点
	bool isBackupForGroup = 11; // 是否为分组备份节点
	bool isOffline = 12; // 是否下线
}

// 查找单个节点的域名解析信息
message FindEnabledNodeDNSRequest {
	int64 nodeId = 1;
	int64 nodeClusterId = 2;
	int64 nodeIPAddrId = 3;
}

message FindEnabledNodeDNSResponse {
	NodeDNSInfo node = 1;
}

// 修改节点的DNS信息
message UpdateNodeDNSRequest {
	int64 nodeId = 1;
	string ipAddr = 2;
	int64 nodeIPAddressId = 5;
	int64 dnsDomainId = 3;
	repeated string routes = 4;
}

// 计算某个区域下的节点数量
message CountAllEnabledNodesWithNodeRegionIdRequest {
	int64 nodeRegionId = 1;
}

// 根据一组ID获取节点信息
message FindEnabledNodesWithIdsRequest {
	repeated int64 nodeIds = 1;
}

message FindEnabledNodesWithIdsResponse {
	repeated Node nodes = 1;
}

// 检查新版本
message CheckNodeLatestVersionRequest {
	string os = 1;
	string arch = 2;
	string currentVersion = 3;
}

message CheckNodeLatestVersionResponse {
	bool hasNewVersion = 1;
	string newVersion = 2;
}

// 设置节点上线状态
message UpdateNodeUpRequest {
	int64 nodeId = 1;
	bool isUp = 2;
}

// 下载最新边缘节点安装文件
message DownloadNodeInstallationFileRequest {
	string os = 1;
	string arch = 2;
	int64 chunkOffset = 3;
}

message DownloadNodeInstallationFileResponse {
	bytes chunkData = 1;
	string sum = 2; // 文件的md5sum
	int64 offset = 3;
	string version = 4;
	string filename = 5;
}

// 修改节点系统信息
message UpdateNodeSystemRequest {
	int64 nodeId = 1;
	int32 maxCPU = 2;
}

// 修改节点缓存设置
message UpdateNodeCacheRequest {
	int64 nodeId = 1; // 节点ID
	SizeCapacity maxCacheDiskCapacity = 2; // 磁盘容量限制
	SizeCapacity maxCacheMemoryCapacity = 3; // 内存容量限制
	string cacheDiskDir = 4; // 磁盘缓存目录
	bytes cacheDiskSubDirsJSON = 5; // 磁盘缓存子目录
}

// 读取节点级别信息
message FindNodeLevelInfoRequest {
}

message FindNodeLevelInfoResponse {
	int32 level = 1;
	bytes parentNodesMapJSON = 2;
}

// 读取节点DNS Resolver
message FindNodeDNSResolverRequest{
	int64 nodeId = 1;
}

message FindNodeDNSResolverResponse {
	bytes dnsResolverJSON = 1;
}

// 修改DNS Resolver
message UpdateNodeDNSResolverRequest {
	int64 nodeId = 1;
	bytes dnsResolverJSON = 2;
}

// 获取节点的DDoS设置
message FindNodeDDoSProtectionRequest {
	int64 nodeId = 1;
}

message FindNodeDDoSProtectionResponse {
	bytes ddosProtectionJSON = 1;
}

// 修改节点的DDoS设置
message UpdateNodeDDoSProtectionRequest {
	int64 nodeId = 1;
	bytes ddosProtectionJSON = 2;
}

// 取得节点的服务全局配置
message FindNodeGlobalServerConfigRequest {
	int64 nodeId = 1;
}

message FindNodeGlobalServerConfigResponse {
	bytes globalServerConfigJSON = 1;
}

// 取得节点的配置概要信息
message FindEnabledNodeConfigInfoRequest {
	int64 nodeId = 1;
}

message FindEnabledNodeConfigInfoResponse {
	bool hasDNSInfo = 1; // 是否有DNS设置
	bool  hasCacheInfo = 2; // 是否有缓存设置
	bool  hasThresholds = 3; // 是否有阈值设置
	bool  hasSSH = 4; // 是否有SSH设置
	bool  hasSystemSettings = 5; // 是否有系统设置
	bool hasDDoSProtection = 6; // 是否有DDoS防护设置
	bool hasScheduleSettings = 7; // 是否有调度设置
}

// 查找节点区域信息数量
message CountAllNodeRegionInfoRequest {
	int64 nodeRegionId = 1; // 区域ID，可选
}

// 列出单页节点区域信息
message ListNodeRegionInfoRequest {
	int64 nodeRegionId = 1; // 区域ID，可选
	int64 offset = 2;
	int64 size = 3;
}

message ListNodeRegionInfoResponse {
	repeated Info infoList = 1;

	message Info {
		int64 id = 1;
		string name = 2;

		NodeRegion nodeRegion = 10;
		NodeCluster nodeCluster = 11;
	}
}

// 修改节点区域信息
message UpdateNodeRegionInfoRequest {
	int64 nodeId = 1;
	int64 nodeRegionId = 2;
}

// 查找单个节点的API相关配置
message FindNodeAPIConfigRequest {
	int64 nodeId = 1;
}

message FindNodeAPIConfigResponse {
	bytes apiNodeAddrsJSON = 1;
}

// 修改某个节点的API相关配置
message UpdateNodeAPIConfigRequest {
	int64 nodeId = 1;
	bytes apiNodeAddrsJSON = 2;
}

// 查找节点的UAM策略
message FindNodeUAMPoliciesRequest {
}

message FindNodeUAMPoliciesResponse {
	repeated UAMPolicy uamPolicies = 1; // UAM策略列表

	message UAMPolicy {
		int64 nodeClusterId = 1; // 集群ID
		bytes uamPolicyJSON = 2; // UAM策略配置
	}
}

// 查找节点的HTTP CC策略
message FindNodeHTTPCCPoliciesRequest {
}

message FindNodeHTTPCCPoliciesResponse {
	repeated HTTPCCPolicy httpCCPolicies = 1; // HTTP CC策略列表

	message HTTPCCPolicy {
		int64 nodeClusterId = 1; // 集群ID
		bytes httpCCPolicyJSON = 2; // HTTP CC策略配置
	}
}

// 查找节点的HTTP3策略
message FindNodeHTTP3PoliciesRequest {
}

message FindNodeHTTP3PoliciesResponse {
	repeated HTTP3Policy http3Policies = 1; // HTTP3策略列表

	message HTTP3Policy {
		int64 nodeClusterId = 1; // 集群ID
		bytes http3PolicyJSON = 2; // HTTP3策略配置
	}
}

// 查找节点的自定义页面策略
message FindNodeHTTPPagesPoliciesRequest {
}

message FindNodeHTTPPagesPoliciesResponse {
	repeated HTTPPagesPolicy httpPagesPolicies = 1; // 自定义页面策略列表

	message HTTPPagesPolicy {
		int64 nodeClusterId = 1; // 集群ID
		bytes httpPagesPolicyJSON = 2; // 自定义页面策略配置
	}
}

// 查找节点调度信息
message FindNodeScheduleInfoRequest {
	int64 nodeId = 1; // 节点ID
}

message FindNodeScheduleInfoResponse {
	ScheduleInfo scheduleInfo = 1; // 调度信息

	message ScheduleInfo {
		string offlineDay = 1; // 下线日期，格式YYYYMMDD
		bool isBackupForCluster = 2; // 是否为集群备份节点
		bool isBackupForGroup = 3; // 是否为分组备份节点
		repeated string backupIPs = 4; // 备用IP
		bytes actionStatusJSON = 5; // 动作状态
	}
}

// 修改节点调度信息
message UpdateNodeScheduleInfoRequest {
	int64 nodeId = 1; // 节点ID
	string offlineDay = 2; // 下线日期，格式YYYYMMDD
	bool isBackupForCluster = 3; // 是否为集群备份节点
	bool isBackupForGroup = 4; // 是否为分组备份节点
	repeated string backupIPs = 5; // 备用IP
}

// 重置节点动作状态
message ResetNodeActionStatusRequest {
	int64 nodeId = 1; // 节点ID
}

// 查找集群的节点调度信息
message FindAllNodeScheduleInfoWithNodeClusterIdRequest {
	int64 nodeClusterId = 1; // 集群ID
}

message FindAllNodeScheduleInfoWithNodeClusterIdResponse {
	repeated ScheduleInfo nodes = 1; // 调动信息列表

	message ScheduleInfo {
		int64 nodeId = 1; // 节点ID
		string nodeName = 2; // 节点名称
		int64 nodeGroupId = 3; // 节点分组ID
		string nodeGroupName = 4; // 节点分组名称
		string offlineDay = 5; // 下线日期，格式YYYYMMDD
		bool isBackupForCluster = 6; // 是否为集群备份节点
		bool isBackupForGroup = 7; // 是否为分组备份节点
		repeated string backupIPs = 8; // 备用IP
		bytes actionStatusJSON = 9; // 动作状态
	}
}

// 同步动作设置到分组
message CopyNodeActionsToNodeGroupRequest {
	int64 nodeId = 1; // 节点ID
}

// 同步动作设置到集群
message CopyNodeActionsToNodeClusterRequest {
	int64 nodeId = 1; // 节点ID
}

// 查找节点的TOA配置
message FindNodeTOAConfigRequest {
}

message FindNodeTOAConfigResponse {
	bytes toaJSON = 1; // TOA配置
}

// 查找节点的网络安全策略
message FindNodeNetworkSecurityPolicyRequest {
}

message FindNodeNetworkSecurityPolicyResponse {
	bytes networkSecurityPolicyJSON = 1; // 网络安全策略
}

// 查找节点的WebP策略
message FindNodeWebPPoliciesRequest {

}

message FindNodeWebPPoliciesResponse {
	repeated WebPPolicy webPPolicies = 1; // WebP策略列表

	message WebPPolicy {
		int64 nodeClusterId = 1; // 集群ID
		bytes webPPolicyJSON = 2; // WebP策略配置
	}
}

// 修改节点的启用状态
message UpdateNodeIsOnRequest {
	int64 nodeId = 1; // 节点ID
	bool isOn = 2; // 是否启用
}