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

package pb;

import "models/rpc_messages.proto";

// HTTP Header策略服务
service HTTPHeaderPolicyService {
	// 查找策略配置
	rpc findEnabledHTTPHeaderPolicyConfig (FindEnabledHTTPHeaderPolicyConfigRequest) returns (FindEnabledHTTPHeaderPolicyConfigResponse);

	// 创建策略
	rpc createHTTPHeaderPolicy (CreateHTTPHeaderPolicyRequest) returns (CreateHTTPHeaderPolicyResponse);

	// 修改AddHeaders
	rpc updateHTTPHeaderPolicyAddingHeaders (UpdateHTTPHeaderPolicyAddingHeadersRequest) returns (RPCSuccess);

	// 修改SetHeaders
	rpc updateHTTPHeaderPolicySettingHeaders (UpdateHTTPHeaderPolicySettingHeadersRequest) returns (RPCSuccess);

	// 修改AddTrailers
	rpc updateHTTPHeaderPolicyAddingTrailers (UpdateHTTPHeaderPolicyAddingTrailersRequest) returns (RPCSuccess);

	// 修改ReplaceHeaders
	rpc updateHTTPHeaderPolicyReplacingHeaders (UpdateHTTPHeaderPolicyReplacingHeadersRequest) returns (RPCSuccess);

	// 修改删除的Headers
	rpc updateHTTPHeaderPolicyDeletingHeaders (UpdateHTTPHeaderPolicyDeletingHeadersRequest) returns (RPCSuccess);

	// 修改非标的Headers
	rpc updateHTTPHeaderPolicyNonStandardHeaders(UpdateHTTPHeaderPolicyNonStandardHeadersRequest) returns (RPCSuccess);

	// 修改策略CORS设置
	rpc updateHTTPHeaderPolicyCORS(UpdateHTTPHeaderPolicyCORSRequest) returns (RPCSuccess);
}

// 查找策略
message FindEnabledHTTPHeaderPolicyConfigRequest {
	int64 httpHeaderPolicyId = 1;
}

message FindEnabledHTTPHeaderPolicyConfigResponse {
	bytes httpHeaderPolicyJSON = 1;
}

// 创建策略
message CreateHTTPHeaderPolicyRequest {

}

message CreateHTTPHeaderPolicyResponse {
	int64 httpHeaderPolicyId = 1;
}

// 修改AddHeaders
message UpdateHTTPHeaderPolicyAddingHeadersRequest {
	int64 httpHeaderPolicyId = 1;
	bytes headersJSON = 2;
}

// 修改SetHeaders
message UpdateHTTPHeaderPolicySettingHeadersRequest {
	int64 httpHeaderPolicyId = 1;
	bytes headersJSON = 2;
}

// 修改AddTrailers
message UpdateHTTPHeaderPolicyAddingTrailersRequest {
	int64 httpHeaderPolicyId = 1;
	bytes headersJSON = 2;
}

// 修改ReplaceHeaders
message UpdateHTTPHeaderPolicyReplacingHeadersRequest {
	int64 httpHeaderPolicyId = 1;
	bytes headersJSON = 2;
}

// 修改删除的Headers
message UpdateHTTPHeaderPolicyDeletingHeadersRequest {
	int64 httpHeaderPolicyId = 1;
	repeated string headerNames = 2;
}

// 修改策略CORS设置
message UpdateHTTPHeaderPolicyCORSRequest {
	int64 httpHeaderPolicyId = 1;
	bytes corsJSON = 2;
}

// 修改非标的Headers
message UpdateHTTPHeaderPolicyNonStandardHeadersRequest {
	int64 httpHeaderPolicyId = 1; // Header策略ID
	repeated string headerNames = 2; // 非标Header名称列表
}