syntax = "proto3";
package governance;
//import "descriptor.proto";
//import "validator.proto";

option go_package = "./;governance";

service Governance{
    rpc List(ListReq) returns (ListResp) {}
    rpc Delete(DeleteReq) returns (DeleteResp) {}
    rpc Edit(EditReq) returns (EditResp) {}
    rpc UpdataStatus(UpdataStatusReq) returns (UpdataStatusResp) {}
    rpc GetGovernanceInfo(GetGovernanceInfoReq) returns (GetGovernanceInfoResp) {}
    rpc Create(CreateReq) returns (CreateResp) {}
    rpc Display(DisplayReq) returns (DisplayResp) {}
}

message LangSetting {
    string langType = 1;//语言类型
    int32 isSetting = 2;//是否设置
}

message GovernanceLangData{
    string title = 1;//标题
    string attachment = 2;//附件
    string attachmentName = 3;//附件名称
    int32 isSetting = 4;//是否设置
}

message GovernanceLang{
    string langType = 1;//语言类型
    GovernanceLangData data = 2;//语言数据
}

message GovernanceInfo{
    string uuid = 1;
    repeated GovernanceLang dataByLang = 2;//语言数据
    int32 sort = 3;//排序
    int32 status = 4;//状态
}

message Item{
    string uuid = 1;
    string title = 2;
    string attachment = 3;
    string attachmentName = 4;
    repeated LangSetting langSetting = 5;//语言设置
    int32 sort = 6;
    int32 status = 7;
    int64 updatedAt = 8;
    string operator = 9;
    int32 operatorId = 10;
}

message DisplayItem{
    string title = 1;
    string attachment = 2;
    string attachmentName = 3;
}

message ListReq{
    string title = 1;
    int32 status = 2; // 1 下架 2 上架
    int32 page = 3;
    int32 pageSize = 4; 
}

message ListResp{
    int32 total = 1;
    repeated Item data =2;
}

message DeleteReq{
    string uuid = 1;
}

message DeleteResp{
}

message EditReq{
    string uuid = 1;
    repeated GovernanceLang dataByLang = 2;
    int32 sort = 3;
    string operator = 4;
    int32 operatorId = 5;
}

message EditResp{
}

message UpdataStatusReq{
    string uuid = 1;
    int32 status = 2;
    string operator = 3;
    int32 operatorId = 4;
}
message UpdataStatusResp{
    string msg = 1;
}

message GetGovernanceInfoReq{
    string uuid = 1;
}
message GetGovernanceInfoResp{
    string msg = 1;
    GovernanceInfo data = 2;
}

message CreateReq{
    string uuid = 1;
    repeated GovernanceLang dataByLang = 2;
    uint32 sort = 3;
    int32 status = 4;
    string operator = 5;
    int32 operatorId = 6;
}

message CreateResp{

}

message DisplayReq{
    string langType = 1;//语言类型
}

message DisplayResp{
    repeated DisplayItem data = 1;
}