syntax = "proto3";
package cloud;
option go_package = "bsm/full/module/base/cloud/pb;cloud";
import "module/base/cloud/proto/const.proto";

// 隐私数据服务
service Private {
  // 创建隐私数据
  rpc CreatePrivateData(CreatePrivateDataRequest) returns (base_cloud_blocks.StatusReply);
  // 获取隐私数据详情
  rpc GetPrivateData(base_cloud_blocks.IdentRequest) returns (CloudPrivateItem);
  // 更新隐私数据
  rpc UpdatePrivateData(CloudPrivateItem) returns (base_cloud_blocks.StatusReply);
  // 删除隐私数据
  rpc DeletePrivateData(base_cloud_blocks.IdentRequest) returns (base_cloud_blocks.StatusReply);
  // 获取隐私数据列表
  rpc ListPrivateData(base_cloud_blocks.FetchRequest) returns (ListPrivateDataResponse);
  // 按类型获取隐私数据
  rpc GetPrivateDataByType(base_cloud_blocks.FetchRequest) returns (ListPrivateDataResponse);
  // 搜索隐私数据
  rpc SearchPrivateData(base_cloud_blocks.FetchRequest) returns (ListPrivateDataResponse);
  // 加密数据
  rpc EncryptData(DataRequest) returns (base_cloud_blocks.StatusReply);
  // 解密数据
  rpc DecryptData(DataRequest) returns (base_cloud_blocks.StatusReply);
}
// 请求消息定义
message CreatePrivateDataRequest {
  uint64 cloud_id = 1;
  string cloud_identity = 2;
  string data_type = 3;               // 数据类型: password, card, document, etc.
  string title = 4;                   // 标题
  string description = 5;             // 描述
  string data = 6;                    // 加密存储的实际数据
  bool is_encrypted = 7;              // 是否已加密
  string tags = 8;                    // 标签
}

message ListPrivateDataResponse {
  repeated CloudPrivateItem data = 1;
  int64 total = 2;
}

message DataRequest {
  string data = 1; // 数据
  string key = 2; // 密钥KEY
}


// 个人隐私数据模型
message CloudPrivateItem {
  uint64 id = 1;
  string identity = 2;
  string data_type = 3;               // 数据类型: password, card, document, etc.
  string title = 4;                   // 标题
  string description = 5;             // 描述
  string data = 6;                    // 加密存储的实际数据
  bool is_encrypted = 7;              // 是否已加密
  string tags = 8;                    // 标签
  string created_at = 9;
  string updated_at = 10;
}
