syntax = "proto3";
package cms;
option go_package = "bsm/full/module/base/cms/pb;cms";
import "protobuf/blocks.proto";

// CMS - 分类
service Category {
  // 分类列表
  rpc Fetch (blocks.IdentRequest) returns (CategoryListReply) {};

  // 添加分类
  rpc Create (blocks.CmsCategoryItem) returns (blocks.StatusReply) {};

  // 修改分类
  rpc Modify (ModifyCategoryRequest) returns (blocks.StatusReply) {};

  // 删除分类
  rpc Delete (DeleteCategoryRequest) returns (blocks.StatusReply) {};
}

  // 分类列表
message CategoryListReply {
  // 数据
  repeated blocks.CmsCategoryItem data = 1;
  // 总数
  int64 count = 2;
}

// 添加分类响应
message AddCategoryResponse{
  string identity = 1; // 添加分类响应唯一标识
}

// 添加分类请求
message AddCategoryRequest{
  string                site_identity = 1 [json_name = "site_identity"];
  string                identity      = 2; // 添加分类请求唯一码
  int64                 parent_id     = 3 [json_name = "parent_id"]; // 为空表示顶级分类
  string                title         = 4; // 标题
  string                cover_path    = 5 [json_name = "cover_path"]; // 封面图片
  string                intro         = 6; // 简介
  string                created_at    = 7 [json_name = "created_at"]; // 创建时间
  string                updated_at    = 8 [json_name = "updated_at"]; // 更新时间
  repeated blocks.CmsCategoryItem data          = 9; // 子集
}

// 修改分类请求
message ModifyCategoryRequest{
  string                site_identity = 1 [json_name = "site_identity"];
  string                identity     = 2; // 修改分类请求唯一标识
  int64                 parent_id    = 3 [json_name = "parent_id"]; // 为空表示顶级分类
  string                title        = 4; // 标题
  string                cover_path   = 5 [json_name = "cover_path"]; // 封面图片
  string                intro        = 6; // 简介
  string                created_at   = 7 [json_name = "created_at"]; // 创建时间
  string                updated_at   = 8 [json_name = "updated_at"]; // 更新时间
  repeated blocks.CmsCategoryItem data         = 9; // 子集
  string                category_key = 10[json_name = "category_key"]; // 分类标识

}

// 删除分类请求
message DeleteCategoryRequest{
  string identity = 1; // 删除分类请求唯一标识
}

// 关键字分类
message KeywordRequest{
  string keyword = 1; // 关键字

}