syntax = "proto3";
option csharp_namespace = "TMDGrpc.SyllabusService";
option java_package = "TMDGrpc.SyllabusService";
package TMDGrpc;


service SyllabusService {
   //查找课纲
   rpc FindSyllabusTree(Dict) returns(stream SyllabusTreeDto);

   //按节点新增课纲
   rpc SaveOrUpdateAsNodes(stream SyllabusNode) returns(Response);

   //按树形新增课纲结构
   rpc SaveOrUpdateAsTree(stream SyllabusTreeDto) returns(stream SyllabusTreeDto);

   //删除课纲
   rpc DeleteSyllabus(Dict) returns(stream SyllabusTreeDto);

}



//请求参数Dict
message Dict {
   //数字Dict
   map<string,double> NMap = 1;
   //字符串Dict
   map<string,string> SMap = 2;
   //布尔Dict
   map<string,bool> BMap = 3;
   //字符串ListMap
   repeated LSMap LSMap = 4;
   //数字ListMap
   repeated LNMap LNMap = 5;
   //Byte ListMap
   repeated LBMap LBMap = 6;
}

//Byte[] Map
message LBMap {
   //Key
   string Key = 1;
   //byte数组
   bytes Value = 2;
}

//数字ListMap
message LNMap {
   //Key
   string Key = 1;
   //数字数组
   repeated double Value = 2 [packed = false];
}

//字符串ListMap
message LSMap {
   //数字Dict
   string Key = 1;
   //字符串数组
   repeated string Value = 2;
}

message SyllabusNode {
   string id = 1;
   //标题
   string title = 2;
   //是否展开
   bool expand = 3;
   //是否编辑
   bool editable = 4;
   //版本
   string version = 5;
   //排序
   int32 order = 6;
   //类型
   int32 type = 7;
   //节点Key
   string nodeKey = 8;
   //父级
   string pid = 9;
   //册别编码
   string volumeCode = 10;
   //数据状态
   int32 status = 11;
   repeated string resources = 12;
   repeated string knowledges = 13;
   bool resource = 14;
   bool knowledge = 15;
}

message SyllabusTreeDto {
   string id = 1;
   //标题
   string title = 2;
   //是否展开
   bool expand = 3;
   //是否编辑
   bool editable = 4;
   //版本
   string version = 5;
   //排序
   int32 order = 6;
   //类型
   int32 type = 7;
   //节点Key
   string nodeKey = 8;
   //父级
   string pid = 9;
   //册别编码
   string volumeCode = 10;
   //数据状态
   int32 status = 11;
   repeated string resources = 12;
   repeated string knowledges = 13;
   bool resource = 14;
   bool knowledge = 15;
   repeated SyllabusTreeDto children = 16;
}

message Response {
   string message = 1;
   int32 code = 2;
}