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

// 分享服务
service Share {
  // 创建分享
  rpc CreateShare(CreateShareRequest) returns (base_cloud_blocks.StatusReply);
  // 获取分享详情
  rpc GetShare(base_cloud_blocks.IdentRequest) returns (CloudShareItem);
  // 删除分享
  rpc DeleteShare(base_cloud_blocks.IdentRequest) returns (base_cloud_blocks.StatusReply);
  // 获取分享列表
  rpc ListShares(base_cloud_blocks.FetchRequest) returns (ListSharesResponse);
  // 验证分享密码
  rpc ValidateSharePassword(ValidateSharePasswordRequest) returns (base_cloud_blocks.StatusReply);
}

// 请求消息定义
message CreateShareRequest {
  uint64 cloud_id = 1;
  string cloud_identity = 2;
  string share_type = 3;              // file, album, note, etc.
  uint64 resource_id = 4;             // 对应资源的ID
  string share_token = 5;             // 分享令牌
  string password = 6;                // 可选分享密码
  string expires_at = 7;              // 过期时间
  bool is_public = 8;                // 是否公开
}

message ListSharesResponse {
  repeated CloudShareItem shares = 1;
  int64 total = 2;
}

message ValidateSharePasswordRequest {
  string identity = 1;
  string password = 2;
}

// 分享系统模型
message CloudShareItem {
  uint64 id = 1;
  string identity = 2;
  string share_type = 3;              // file, album, note, etc.
  uint64 resource_id = 4;             // 对应资源的ID
  string share_token = 5;             // 分享令牌
  string password = 6;                // 可选分享密码
  string expires_at = 7;              // 过期时间
  int32 view_count = 8;               // 浏览次数
  int32 download_count = 9;           // 下载次数
  bool is_public = 10;                // 是否公开
  string created_at = 11;
  string updated_at = 12;
}
