syntax = "proto3";

option go_package ="./pb";

package pb;

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

//--------------------------------walletTransactions--------------------------------
message WalletTransactions {
  int64 id = 1; //id
  int64 userId = 2; //userId
  string type = 3; //type
  string amount = 4; //amount
  string balanceAfter = 5; //balanceAfter
  string description = 6; //description
  int64 orderId = 7; //orderId
  int64 createdAt = 8; //createdAt
  string searchText = 9; //searchText
}

message AddWalletTransactionsReq {
  int64 userId = 1; //userId
  string type = 2; //type
  string amount = 3; //amount
  string balanceAfter = 4; //balanceAfter
  string description = 5; //description
  int64 orderId = 6; //orderId
  int64 createdAt = 7; //createdAt
  string searchText = 8; //searchText
}

message AddWalletTransactionsResp {
}

message UpdateWalletTransactionsReq {
  int64 id = 1; //id
  optional int64 userId = 2; //userId
  optional string type = 3; //type
  optional string amount = 4; //amount
  optional string balanceAfter = 5; //balanceAfter
  optional string description = 6; //description
  optional int64 orderId = 7; //orderId
  optional int64 createdAt = 8; //createdAt
  optional string searchText = 9; //searchText
}

message UpdateWalletTransactionsResp {
}

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

message DelWalletTransactionsResp {
}

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

message GetWalletTransactionsByIdResp {
  WalletTransactions walletTransactions = 1; //walletTransactions
}

message SearchWalletTransactionsReq {
  int64 offset = 1; //offset
  int64 limit = 2; //limit
  int64 id = 3; //id
  optional int64 userId = 4; //userId
  optional string type = 5; //type
  optional string amount = 6; //amount
  optional string balanceAfter = 7; //balanceAfter
  optional string description = 8; //description
  optional int64 orderId = 9; //orderId
  optional int64 createdAt = 10; //createdAt
  optional string searchText = 11; //searchText
}

message SearchWalletTransactionsResp {
  repeated WalletTransactions walletTransactions = 1; //walletTransactions
}

//--------------------------------wallets--------------------------------
message Wallets {
  int64 userId = 1; //userId
  string balance = 2; //balance
  string frozenBalance = 3; //frozenBalance
  int64 updatedAt = 4; //updatedAt
  int64 version = 5; //version
}

message AddWalletsReq {
  int64 userId = 1; //userId
  string balance = 2; //balance
  string frozenBalance = 3; //frozenBalance
  int64 updatedAt = 4; //updatedAt
}

message AddWalletsResp {
}

message UpdateWalletsReq {
  int64 userId = 1; //userId
  optional string balance = 2; //balance
  optional string frozenBalance = 3; //frozenBalance
  optional int64 updatedAt = 4; //updatedAt
  optional int64 version = 5; //version
}

message UpdateWalletsResp {
}

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

message DelWalletsResp {
}

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

message GetWalletsByIdResp {
  Wallets wallets = 1; //wallets
}

message SearchWalletsReq {
  int64 offset = 1; //offset
  int64 limit = 2; //limit
  int64 userId = 3; //userId
  optional string balance = 4; //balance
  optional string frozenBalance = 5; //frozenBalance
  optional int64 updatedAt = 6; //updatedAt
}

message SearchWalletsResp {
  repeated Wallets wallets = 1; //wallets
}



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

service walletService{

	 //-----------------------walletTransactions----------------------- 
	 rpc AddWalletTransactions(AddWalletTransactionsReq) returns (AddWalletTransactionsResp); 
	 rpc UpdateWalletTransactions(UpdateWalletTransactionsReq) returns (UpdateWalletTransactionsResp); 
	 rpc DelWalletTransactions(DelWalletTransactionsReq) returns (DelWalletTransactionsResp); 
	 rpc GetWalletTransactionsById(GetWalletTransactionsByIdReq) returns (GetWalletTransactionsByIdResp); 
	 rpc SearchWalletTransactions(SearchWalletTransactionsReq) returns (SearchWalletTransactionsResp); 
	 //-----------------------wallets----------------------- 
	 rpc AddWallets(AddWalletsReq) returns (AddWalletsResp); 
	 rpc UpdateWallets(UpdateWalletsReq) returns (UpdateWalletsResp); 
	 rpc DelWallets(DelWalletsReq) returns (DelWalletsResp); 
	 rpc GetWalletsById(GetWalletsByIdReq) returns (GetWalletsByIdResp); 
	 rpc SearchWallets(SearchWalletsReq) returns (SearchWalletsResp); 

}
