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

package pb;

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

// 工单服务
service UserTicketService {
	// 创建工单
	rpc createUserTicket(CreateUserTicketRequest) returns (CreateUserTicketResponse);

	// 修改工单
	rpc updateUserTicket(UpdateUserTicketRequest) returns (RPCSuccess);

	// 删除工单
	rpc deleteUserTicket(DeleteUserTicketRequest) returns (RPCSuccess);

	// 计算工单数量
	rpc countUserTickets(CountUserTicketsRequest) returns (RPCCountResponse);

	// 列出单页工单
	rpc listUserTickets(ListUserTicketsRequest) returns (ListUserTicketsResponse);

	// 查找单个工单
	rpc findUserTicket(FindUserTicketRequest) returns (FindUserTicketResponse);
}

// 创建工单
message CreateUserTicketRequest {
	int64 userTicketCategoryId = 1;
	string subject = 2;
	string body = 3;
}

message CreateUserTicketResponse {
	int64 userTicketId = 1;
}

// 修改工单
message UpdateUserTicketRequest {
	int64 userTicketId = 1;
	int64 userTicketCategoryId = 2;
	string subject = 3;
	string body = 4;
}

// 删除工单
message DeleteUserTicketRequest {
	int64 userTicketId = 1;
}

// 计算工单数量
message CountUserTicketsRequest {
	int64 userId = 1;
	int64 userTicketCategoryId = 2;
	string status = 3;
}

// 列出单页工单
message ListUserTicketsRequest {
	int64 userId = 1;
	int64 userTicketCategoryId = 2;
	string status = 3;
	int64 offset = 4;
	int64 size = 5;
}

message ListUserTicketsResponse {
	repeated UserTicket userTickets = 1;
}

// 查找单个工单
message FindUserTicketRequest {
	int64 userTicketId = 1;
}

message FindUserTicketResponse {
	UserTicket userTicket = 1;
}