syntax = "proto3";
package giftcard;

message Balance {
  string card_id = 1;
  int32 balance = 2;
}

message Log {
  string datetime = 1;
  string ref_kind = 2;
  string ref = 3;
  int32 transaction = 4;
}

message CardDetails {
  string id = 1;
  int32 balance = 2;
  Log log = 4;
}

message GetCardRequest { string card_id = 1; }

message PurchaseRequest {
  string card_id = 1;
  int32 amount = 2;
  string purchase_id = 3;
  string created_by = 4;
}

message CloseCardRequest {}

message PayMoneyInRequest {
  int32 amount = 1;
  string cash_transaction_id = 2;
  string created_by = 3;
}

service GiftcardService {
  rpc GetCard(GetCardRequest) returns (CardDetails);
  rpc Purchase(PurchaseRequest) returns (CardDetails);
  rpc CloseCard(CloseCardRequest) returns (CardDetails);
  rpc PayMoneyIn(PayMoneyInRequest) returns (CardDetails);
}