syntax = "proto3";

service BookService {
    rpc GetList (GetListRequest) returns (GetListResponse);

    rpc AddBooks (AddBookRequest) returns (GeneralResponse);

    rpc DeleteBooks (DeleteBookRequest) returns (GeneralResponse);

    rpc UpdateBook (UpdateBookRequest) returns (GeneralResponse);

    rpc Ping (Empty) returns (MessageResponse);
}

message Empty {}

message GetListRequest {
    int32 pages = 1;
    int32 per_page = 2;
    int32 list_data_limit = 3;
}

message AddBookRequest {
    repeated Book_info books = 1;
    bool test_only = 2;
}

message DeleteBookRequest {
    repeated int32 book_ids = 1;
    int32 delete_last_count = 2;
}

message UpdateBookRequest {
    Book_info book = 1;
}

message MessageResponse {
    string message = 1;
}

message GeneralResponse {
    MessageResponse response_data = 1;
    Server_deserialize server_deserialize = 2;
    double server_protocol_total_time = 3;
    Server_deserialize server_serialize = 4;
}

message GetListResponse {
    repeated Book_info response_data = 1;
    Server_deserialize server_deserialize = 2;
    double server_protocol_total_time = 3;
    Server_deserialize server_serialize = 4;
}

message Server_deserialize {
    double cpu = 1;
    double time = 2;
}

message Book_info {
    string abstract = 1;
    string author = 2;
    string barcode = 3;
    string binding = 4;
    int32 category_id = 5;
    string cover_image = 6;
    string description = 7;
    string edition = 8;
    string editor = 9;
    string format = 10;
    int32 id = 11;
    string isbn = 12;
    string keywords = 13;
    string language = 14;
    int32 pages = 15;
    int64 publication_date = 16;
    string publisher = 17;
    string subject = 18;
    string subtitle = 19;
    string title = 20;
    string translator = 21;
    double weight = 22;
}