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

// 单页管理
service Pages{
	// 单页列表
  rpc Fetch(PagesListRequest) returns (PagesListReply) {};

	//获取单页详情 By Identity
  rpc GetByIdentity (GetPagesRequest) returns (PagesItem) {};

    //获取单页详情 By Key
  rpc GetByKey (GetPagesByKeyRequest) returns (PagesItem) {};

	//发布单页
  rpc Create(PagesItem) returns (blocks.StatusReply) {};

	//修改单页
  rpc Modify(PagesItem) returns (blocks.StatusReply) {};

	//删除单页
  rpc Delete(blocks.IdentRequest) returns (blocks.StatusReply) {};
}

// 根据KEY获取内容请求
message GetPagesByKeyRequest{
  string key = 1; //<必传> 内容页的key
}

// 文章
message PagesItem{
  string site_identity = 1 [json_name = "site_identity"];
  string identity      = 2; // 文章唯一标识
  string created_at    = 3 [json_name = "created_at"]; // 创建时间
  string updated_at    = 4 [json_name = "updated_at"]; //更新时间
  int32  post_type     = 5 [json_name = "post_type"]; // 用户自定义文章类型
  string rights        = 6; //权限
  string title         = 7; // <必传>,标题
  string key           = 8; //<必传> 内容页的key
  string description   = 9; //简介
  string cover_path    = 10 [json_name = "cover_path"]; //封面
  string content       = 11; // <必传>,内容
  bool   has_accessory = 12 [json_name = "has_accessory"]; //是否有附件,默认没有

  repeated string        accessory_identity_array = 13 [json_name = "accessory_identity_array"]; //附件Identity 列表
  repeated blocks.CmsAccessoryItem accessory_data           = 14 [json_name = "accessory_data"]; //附件数据
  repeated blocks.CmsTagsItem      tags_data                = 15 [json_name = "tags_data"]; // 标签数据
  repeated string        tags_identity_array      = 16 [json_name = "tags_identity_array"]; // 标签集Identity 列表
  int64                  hits                     = 17; //点击量
}

// 文章列表请求
message PagesListRequest{
  int64  page    = 1; // 页码,默认第一页
  int64  size    = 2; // 单页显示数量,默认10,最多50
  string keyword = 3; // 根据文章名称模糊查找
  int32  type    = 4; // 根据用户自定义文章类型过滤,可选,默认0,全部查找
}

// 文章列表回复
message PagesListReply{
  repeated PagesItem data  = 1; // 数据
  int64              count = 2; // 总数量
}

// 获取文章详情请求
message GetPagesRequest {
  string identity = 1; // 必传唯一标识
}
