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

// 相册服务
service Album {
  // 创建相册
  rpc CreateAlbum(CreateAlbumRequest) returns (base_cloud_blocks.StatusReply);
  // 获取相册详情
  rpc GetAlbum(base_cloud_blocks.IdentRequest) returns (CloudAlbumItem);
  // 更新相册
  rpc UpdateAlbum(CloudAlbumItem) returns (base_cloud_blocks.StatusReply);
  // 删除相册
  rpc DeleteAlbum(base_cloud_blocks.IdentRequest) returns (base_cloud_blocks.StatusReply);
  // 获取相册列表
  rpc ListAlbums(base_cloud_blocks.FetchRequest) returns (ListAlbumsResponse);
  // 设置封面照片
  rpc SetCoverPhoto(SetCoverPhotoRequest) returns (base_cloud_blocks.StatusReply);

  // 上传照片
  rpc UploadPhoto(CloudPhotoItem) returns (base_cloud_blocks.StatusReply);
  // 获取照片详情
  rpc GetPhoto(base_cloud_blocks.IdentRequest) returns (CloudPhotoItem);
  // 更新照片
  rpc UpdatePhoto(CloudPhotoItem) returns (base_cloud_blocks.StatusReply);
  // 删除照片
  rpc DeletePhoto(base_cloud_blocks.IdentRequest) returns (base_cloud_blocks.StatusReply);
  // 获取照片列表
  rpc ListPhotos(base_cloud_blocks.FetchRequest) returns (ListPhotosResponse);
  // 移动照片到其他相册
  rpc MovePhoto(MovePhotoRequest) returns (base_cloud_blocks.StatusReply);
}

// 请求消息定义
message CreateAlbumRequest {
  uint64 cloud_id = 1;
  string cloud_identity = 2;
  string name = 3;                    // 相册名称
  string description = 4;             // 相册描述
  string cover_photo = 5;             // 封面照片URL
  bool is_private = 6;                // 是否私有
}

message ListAlbumsResponse {
  repeated CloudAlbumItem albums = 1;
  int64 total = 2;
}

message SetCoverPhotoRequest {
  uint64 album_id = 1;
  uint64 photo_id = 2;
}

// 相册模型
message CloudAlbumItem {
  uint64 id = 1;
  string identity = 2;
  string name = 3;                    // 相册名称
  string description = 4;             // 相册描述
  string cover_photo = 5;             // 封面照片URL
  bool is_private = 6;                // 是否私有
  string created_at = 7;
  string updated_at = 8;

  // 关联关系
  repeated CloudPhotoItem photos = 9;     // 相册下的照片
}


message ListPhotosResponse {
  repeated CloudPhotoItem photos = 1;
  int64 total = 2;
}

message MovePhotoRequest {
  uint64 photo_id = 1;
  uint64 new_album_id = 2;
}


// 照片模型
message CloudPhotoItem {
  uint64 id = 1;
  string identity = 2;
  uint64 album_id = 3;                // 专辑ID
  string title = 4;                   // 照片标题
  string description = 5;             // 照片描述
  string file_path = 6;               // 文件路径
  int64 file_size = 7;                // 文件大小
  string mime_type = 8;               // 文件类型
  int32 width = 9;                    // 图片宽度
  int32 height = 10;                  // 图片高度
  string taken_at = 11; // 拍摄时间
  string location = 12;               // 拍摄地点
  string tags = 13;                   // 标签，逗号分隔
  string created_at = 14;
  string updated_at = 15;

  // 关联关系
  CloudAlbumItem album = 16;
}
