Correction to default value in avro message
[aquarium] / src / main / avro / aquarium-user-state.avdl
index f7b0c5d..d05a8f2 100644 (file)
@@ -43,10 +43,12 @@ protocol AquariumUserState {
     string id;
     union {string, null} relatedIMEventOriginalID;
     string userID;
+    long occurredMillis = 0; // when was this agreement created inside Aquarium
     long @order("ascending") validFromMillis;
     long validToMillis;
     string role;
     union {FullPriceTableMsg, null} fullPriceTableRef; // If null, then get from aquarium policy
+    union {IMEventMsg, null} relatedIMEventMsg; // non-null if there is a related IMEvent
   }
 
   record ResourceInstanceChargingStateMsg {
@@ -56,10 +58,10 @@ protocol AquariumUserState {
     map<AnyValueMsg> details;
     array<ResourceEventMsg> previousEvents;
     array<ResourceEventMsg> implicitlyIssuedStartEvents;
-    double accumulatingAmount;
-    double oldAccumulatingAmount;
-    double previousValue;
-    double currentValue;
+   string accumulatingAmount;
+   string oldAccumulatingAmount;
+   string previousValue;
+   string currentValue;
   }
 
   record ResourcesChargingStateMsg {
@@ -69,24 +71,30 @@ protocol AquariumUserState {
   }
 
   record UserAgreementHistoryMsg {
+    string originalID;
+    union {string, null} inStoreID;
+    string userID;
+    long latestOccurredMillis; // the latest occurredMillis of all underlying agreements
+    long latestValidFromMillis; // the latest validFromMillis of all underlying agreements
+    long userCreationTimeMillis = 0;
     array<UserAgreementMsg> agreements;
   }
 
   record ChargeslotMsg {
     long startMillis;
     long stopMillis;
-    double unitPrice;
+   string unitPrice;
     string explanation = "";
-    double creditsToSubtract = 0.0;
+   string creditsToSubtract = 0.0;
   }
 
   // The following equation must hold (within a very small error):
   //   `newTotalCredits = oldTotalCredits - sumOfCreditsToSubtract`.
   record WalletEntryMsg {
     string userID; // The user ID this wallet entry is related to.
-    double sumOfCreditsToSubtract; // The credit amount generated for this wallet entry.
-    double oldTotalCredits;
-    double newTotalCredits;
+    string sumOfCreditsToSubtract; // The credit amount generated for this wallet entry.
+    string oldTotalCredits;
+    string newTotalCredits;
     long whenComputedMillis; // When the computation took place
     long referenceStartMillis;
     long referenceStopMillis;
@@ -105,16 +113,15 @@ protocol AquariumUserState {
   }
 
   record UserStateMsg {
-    string @aliases(["id"]) originalID; // internal Aquarium ID
-    union {string, null} @aliases(["_id", "idInStore"]) inStoreID; // From Aquarium store
+    string originalID; // internal Aquarium ID
+    union {string, null} inStoreID; // From Aquarium store
     string userID;
     long occurredMillis; // When we created the event
     union {string, null} parentOriginalID;
     union {string, null} parentInStoreID;
-    map<ResourceTypeMsg> resourceTypesMap;
-    map<ResourcesChargingStateMsg> stateOfResources; // key is resourceType.name
-    double totalCredits = 0.0;
-    UserAgreementHistoryMsg agreementHistory;
+    boolean isFirst = false; // True only for the very first user state
+    map<ResourcesChargingStateMsg> stateOfResources; // Map[ResourceTypeMsg.name.type, ]
+    string totalCredits = "0";
     long latestUpdateMillis; // // last update of this working user state
     long latestResourceEventOccurredMillis;
     long billingPeriodOutOfSyncResourceEventsCounter = 0;