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 Create(CreateReq) returns (CreateResp) {}
    rpc Display(DisplayReq) returns (DisplayResp) {}
}

message Item{
    int32 id = 1;
    string title = 2;
    string attachment = 3;
    string attachmentName = 4;
    int32 sort = 5;
    int32 status = 6;
    int64 updatedAt = 7;
    string operator = 8;
    int32 operatorId = 9;
}

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{
    int32 id = 1;
}

message DeleteResp{
}

message EditReq{
    uint32 id = 1;
    string title = 2;
    string attachment = 3;
    string attachmentName = 4;
    int32 sort = 5;
    int32 status = 6;
    string operator = 7;
    int32 operatorId = 8;
}

message EditResp{
}

message CreateReq{
    string title = 1;
    uint32 sort = 2;
    string attachment = 3;
    string attachmentName = 4;
    int32 status = 5;
    string operator = 6;
    int32 operatorId = 7;
}

message CreateResp{

}

message DisplayReq{

}

message DisplayResp{
    repeated Item data = 1;
}