syntax = "proto3";
option go_package = "./pb";

package pb;

import "models/model_message.proto";
import "models/rpc_messages.proto";

// 消息相关服务
service MessageService {
	// 计算未读消息数
	rpc countUnreadMessages (CountUnreadMessagesRequest) returns (RPCCountResponse);

	// 列出单页未读消息
	rpc listUnreadMessages (ListUnreadMessagesRequest) returns (ListUnreadMessagesResponse);

	// 设置消息已读状态
	rpc updateMessageRead (UpdateMessageReadRequest) returns (RPCSuccess);

	// 设置一组消息已读状态
	rpc updateMessagesRead (UpdateMessagesReadRequest) returns (RPCSuccess);

	// 设置所有消息为已读
	rpc updateAllMessagesRead (UpdateAllMessagesReadRequest) returns (RPCSuccess);
}

// 计算未读消息数
message CountUnreadMessagesRequest {

}

// 列出单页未读消息
message ListUnreadMessagesRequest {
	int64 offset = 1;
	int64 size = 2;
}

message ListUnreadMessagesResponse {
	repeated Message messages = 1;
}

// 设置消息已读状态
message UpdateMessageReadRequest {
	int64 messageId = 1;
	bool isRead = 2;
}

// 设置一组消息已读状态
message UpdateMessagesReadRequest {
	repeated int64 messageIds = 1;
	bool isRead = 2;
}

// 设置所有消息为已读
message UpdateAllMessagesReadRequest {

}