syntax = "proto3";
package trust_service;

service TrustService {
  rpc Deposit      (TrustTransactionRequest) returns (TrustBalanceResponse);
  rpc Disburse     (TrustTransactionRequest) returns (TrustBalanceResponse);
  rpc GetBalance   (GetBalanceRequest)       returns (TrustBalanceResponse);
  rpc GetLedger    (GetLedgerRequest)        returns (LedgerResponse);
}

message TrustTransactionRequest {
  string tenant_id    = 1;
  string client_id    = 2;
  string matter_id    = 3;
  double amount       = 4;
  string description  = 5;
  string reference    = 6;
}
message GetBalanceRequest { string tenant_id = 1; string client_id = 2; }
message GetLedgerRequest  { string tenant_id = 1; string client_id = 2; string matter_id = 3; }

message TrustBalanceResponse { string client_id = 1; double balance = 2; int64 updated_at = 3; }
message LedgerEntry          { string id = 1; string type = 2; double amount = 3; string description = 4; int64 created_at = 5; }
message LedgerResponse       { string client_id = 1; repeated LedgerEntry entries = 2; }
