3DMSJR64RXGFQMHBPJ3RS7GYR537WISXHNEVQY63S7WFNSK6EM3AC
enum TransactionState {
TRANS_OPEN = 0;
TRANS_PAYED = 1;
TRANS_REVOKED = 2;
enum Units {
U_D = 0; // discrete
U_G = 1; // gram
U_M = 2; // metre
U_L = 3; // litre
}
message Usage {
double amount = 0;
uint64 item = 1;
optional string comment = 2;
}
message Product {
string name = 0;
Money price = 1; // default price to use
Units units = 2;
bool to_sell = 10;
bool to_buy = 11;
bool need_date_from = 12;
bool need_date_to = 13;
optional string comment = 40;
repeated Usage usage = 50;
repeated string tag = 51; // product is shown in different places depending on tag
repeated uint64 invalidates = 90; // tid's of products to invalidate
Timestamp ts = 2;
TransactionType type = 3;
Money discount = 4;
Timestamp expire = 5;
optional string comment = 6;
Timestamp ts = 0;
Timestamp valid_until = 2;
optional uint64 customer = 1; // customer tid
optional Money discount = 2;
repeated TransactionEntry entry = 3;
message Transaction {
uint64 tid = 0;
uint64 parent = 1;
uint64 user = 2;
uint64 ts = 3; // unix time in seconds
string signature = 4;
oneof transaction_type {
SellTransaction sell = 10;
BuyTransaction buy = 11;
RentTransaction rent = 12;
Invalidate invalidate = 13;
Customer customer = 20;
Product product = 21;
Payment payment = 30;
User user = 90;
}
}
message Database {
uint64 next_tid = 0;
map<uint64, Transaction> transactions = 1;
}