syntax = "proto3";

option go_package ="./pb";

package pb;

// ------------------------------------
// Messages
// ------------------------------------

//--------------------------------orders--------------------------------
message Orders {
  int64 id = 1; //id
  int64 consumerId = 2; //consumerId
  int64 playerId = 4; //playerId
  optional int64 shopId = 6; //shopId
  string serviceSnapshot = 8; //serviceSnapshot
  string status = 9; //status
  string totalPrice = 10; //totalPrice
  optional string note = 11; //note
  int64 version = 12; //version
  optional string timeoutJobId = 13; //timeoutJobId
  string searchText = 14; //searchText
  int64 createdAt = 15; //createdAt
  optional int64 acceptedAt = 16; //acceptedAt
  optional int64 closedAt = 17; //closedAt
  optional int64 completedAt = 18; //completedAt
  optional int64 cancelledAt = 19; //cancelledAt
  int64 updatedAt = 20; //updatedAt
}

message AddOrdersReq {
  int64 id = 1; //id
  int64 consumerId = 2; //consumerId
  int64 playerId = 4; //playerId
  optional int64 shopId = 6; //shopId
  string serviceSnapshot = 8; //serviceSnapshot
  optional string status = 9; //status
  string totalPrice = 10; //totalPrice
  optional string note = 11; //note
  optional int64 version = 12; //version
  optional string timeoutJobId = 13; //timeoutJobId
  optional string searchText = 14; //searchText
  optional int64 createdAt = 15; //createdAt
  optional int64 acceptedAt = 16; //acceptedAt
  optional int64 closedAt = 17; //closedAt
  optional int64 completedAt = 18; //completedAt
  optional int64 cancelledAt = 19; //cancelledAt
  optional int64 updatedAt = 20; //updatedAt
}

message AddOrdersResp {
  int64 id = 1; //id
}

message UpdateOrdersReq {
  int64 id = 1; //id
  optional int64 consumerId = 2; //consumerId
  optional int64 playerId = 4; //playerId
  optional int64 shopId = 6; //shopId
  optional string serviceSnapshot = 8; //serviceSnapshot
  optional string status = 9; //status
  optional string totalPrice = 10; //totalPrice
  optional string note = 11; //note
  optional int64 version = 12; //version
  optional string timeoutJobId = 13; //timeoutJobId
  optional string searchText = 14; //searchText
  optional int64 createdAt = 15; //createdAt
  optional int64 acceptedAt = 16; //acceptedAt
  optional int64 closedAt = 17; //closedAt
  optional int64 completedAt = 18; //completedAt
  optional int64 cancelledAt = 19; //cancelledAt
  optional int64 updatedAt = 20; //updatedAt
}

message UpdateOrdersResp {
}

message DelOrdersReq {
  int64 id = 1; //id
}

message DelOrdersResp {
}

message GetOrdersByIdReq {
  int64 id = 1; //id
}

message GetOrdersByIdResp {
  Orders orders = 1; //orders
}

message SearchOrdersReq {
  int64 offset = 1; //offset
  int64 limit = 2; //limit
  optional int64 id = 3; //id
  optional int64 consumerId = 4; //consumerId
  optional int64 playerId = 6; //playerId
  optional int64 shopId = 8; //shopId
  optional string serviceSnapshot = 10; //serviceSnapshot
  optional string status = 11; //status
  optional string totalPrice = 12; //totalPrice
  optional string note = 13; //note
  optional int64 version = 14; //version
  optional string timeoutJobId = 15; //timeoutJobId
  optional string searchText = 16; //searchText
  optional int64 createdAt = 17; //createdAt
  optional int64 acceptedAt = 18; //acceptedAt
  optional int64 closedAt = 19; //closedAt
  optional int64 completedAt = 20; //completedAt
  optional int64 cancelledAt = 21; //cancelledAt
  optional int64 updatedAt = 22; //updatedAt
}

message SearchOrdersResp {
  repeated Orders orders = 1; //orders
}

//--------------------------------orderStateLogs--------------------------------
message OrderStateLogs {
  int64 id = 1; //id
  int64 orderId = 2; //orderId
  optional string fromStatus = 3; //fromStatus
  string toStatus = 4; //toStatus
  string action = 5; //action
  int64 actorId = 6; //actorId
  string actorRole = 7; //actorRole
  optional string metadata = 8; //metadata
  int64 createdAt = 9; //createdAt
}

message AddOrderStateLogsReq {
  int64 id = 1; //id
  int64 orderId = 2; //orderId
  optional string fromStatus = 3; //fromStatus
  string toStatus = 4; //toStatus
  string action = 5; //action
  int64 actorId = 6; //actorId
  string actorRole = 7; //actorRole
  optional string metadata = 8; //metadata
  optional int64 createdAt = 9; //createdAt
}

message AddOrderStateLogsResp {
}

message UpdateOrderStateLogsReq {
  int64 id = 1; //id
  optional int64 orderId = 2; //orderId
  optional string fromStatus = 3; //fromStatus
  optional string toStatus = 4; //toStatus
  optional string action = 5; //action
  optional int64 actorId = 6; //actorId
  optional string actorRole = 7; //actorRole
  optional string metadata = 8; //metadata
  optional int64 createdAt = 9; //createdAt
}

message UpdateOrderStateLogsResp {
}

message DelOrderStateLogsReq {
  int64 id = 1; //id
}

message DelOrderStateLogsResp {
}

message GetOrderStateLogsByIdReq {
  int64 id = 1; //id
}

message GetOrderStateLogsByIdResp {
  OrderStateLogs orderStateLogs = 1; //orderStateLogs
}

message SearchOrderStateLogsReq {
  int64 offset = 1; //offset
  int64 limit = 2; //limit
  optional int64 id = 3; //id
  optional int64 orderId = 4; //orderId
  optional string fromStatus = 5; //fromStatus
  optional string toStatus = 6; //toStatus
  optional string action = 7; //action
  optional int64 actorId = 8; //actorId
  optional string actorRole = 9; //actorRole
  optional string metadata = 10; //metadata
  optional int64 createdAt = 11; //createdAt
}

message SearchOrderStateLogsResp {
  repeated OrderStateLogs orderStateLogs = 1; //orderStateLogs
}

// ------------------------------------
// Rpc Func
// ------------------------------------

service orderService {
  //-----------------------orders-----------------------
  rpc AddOrders(AddOrdersReq) returns (AddOrdersResp);
  rpc UpdateOrders(UpdateOrdersReq) returns (UpdateOrdersResp);
  rpc DelOrders(DelOrdersReq) returns (DelOrdersResp);
  rpc GetOrdersById(GetOrdersByIdReq) returns (GetOrdersByIdResp);
  rpc SearchOrders(SearchOrdersReq) returns (SearchOrdersResp);

  //-----------------------orderStateLogs-----------------------
  rpc AddOrderStateLogs(AddOrderStateLogsReq) returns (AddOrderStateLogsResp);
  rpc UpdateOrderStateLogs(UpdateOrderStateLogsReq) returns (UpdateOrderStateLogsResp);
  rpc DelOrderStateLogs(DelOrderStateLogsReq) returns (DelOrderStateLogsResp);
  rpc GetOrderStateLogsById(GetOrderStateLogsByIdReq) returns (GetOrderStateLogsByIdResp);
  rpc SearchOrderStateLogs(SearchOrderStateLogsReq) returns (SearchOrderStateLogsResp);
}
