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

// Store(店铺)微服务-分类
service Category{
  //  获取分类数据
  rpc Fetch(CategoryFetchRequest) returns(CategoryReply) {};

  //  添加分类
  rpc Create(CategoryItem) returns(blocks.IdentityStatusReply) {};

  //  删除分类
  rpc Delete(blocks.IdentRequest) returns(blocks.IdentityStatusReply) {};

  //  修改分类
  rpc Modify(CategoryItem) returns(blocks.IdentityStatusReply) {};

}

message CategoryFetchRequest{
  string types = 1; // 需要的分类类型:all-所有分类(默认),first-一级分类
  string keywords = 2; // 关键字
  int64 id = 3; // 需要被查询的id
  string store_identity = 4 [json_name="store_identity"]; // 店铺唯一标识
}

message CategoryReply{
  int64 count = 1; // 数量
  repeated CategoryItem data = 2;
}

message CategoryItem{
  int64  id = 1; //ID
  string identity = 2;
  string title = 3; //名称
  string en_title = 4 [json_name="en_title"]; //英文名称
  int64  parent_id = 5 [json_name="parent_id"]; //上级ID
  string paths = 6; //路径
  string intro = 7; //简介
  string icon = 8; //图标
  int32  sort = 9; //排序
  int32 status = 10; // 状态：1-正常，2停用
  string created_at = 11 [json_name="created_at"]; // 创建时间
  repeated CategoryItem categories = 12; // 子集
  string keys = 13; //关键词
}