/**
 * <p class=proto-main>The messages in ADA.Proto are intended for flexible data collection and diagnostic commands with direct communication to FCA ADA infrastructure .</p>
 *
 *<div class=proto-hier>
 * UconnectAny
 *     |
 *     |---- <a href="#com.fca.uconnect.global.Ada.AdaBundleEvent">AdaBundleEvent</a>
 *     |                    |
 *     |                    |---- <a href="#com.fca.uconnect.global.Ada.AdaBundleEvent.AdaBundle">AdaBundle</a>
 *     |                    |
 *     |---- <a href="#com.fca.uconnect.global.Ada.AdaPolicy">AdaPolicy</a>
 *     |                    |
 *     |                    |---- <a href=""#com.fca.uconnect.global.Ada.AdaPolicy.AdaPlan">AdaPlan</a>
 *
 *
 * </div>
 *  <h3 class=change-log-hdr> Change Log</h3>
 *  <table id="change-log" class="change-log"><thead><tr>
 *	<th>Version</th><th>Date</th><th>Notes</th></tr></thead>
 *   <tbody>
 *	<tr><td>1.0</td><td>2019-09-30</td><td>Release of initial Proto.</td></tr>
 *	</tbody></table>
 *  <h3 >List of MQTT Topics</h3>
 *  <table ><thead><tr>
 *	<th>Flow</th><th>Type</th><th>Topic Name</th></tr></thead>
 *    <tbody>
 *   <tr><td>Cloud send to Vehicle</td><td>Publish</td><td>fcaada/${iot:ClientId}/ADA</td></tr>
 *	 <tr><td>Cloud receive from Vehicle</td><td>Subscribe</td><td>fcaada/ADA/#</td></tr>
 *	 <tr><td>Vehicle send to Cloud </td><td>Publish</td><td>fcaada/ADA/${iot:ClientId}</td></tr>
 *	 <tr><td>Vehicle receive from Cloud </td><td>Subscribe</td><td>fcaada/${iot:ClientId}/#</td></tr>
 *	</tbody></table>
 * <h3 class=change-log-hdr>Data Flow</h3>
 *
 * <p class=proto-main>Sequence Diagram with ADA Communication Strategy :</p>
 *
 *    <img class=img-border src=./images/ada2.png>

 */

syntax = "proto3";
package com.fca.uconnect.global;

message AdaBundleEvent {
	string timestamp = 1; /// Bundle upload time. Unit - UTC epoch in milliseconds.
	string vin = 2; /// Vehicle Identification Number.
	int64 id = 3; /// Policy id.
	string hash = 4; /// TBD.
	int64 period = 5; /// Period of plan for which data is being uploaded.
	repeated AdaBundle bundle = 6; /// List of data bundles.
}

message AdaBundle {
	repeated string data  = 1; /// Bundle data item.
}

message AdaPolicy {
	int64 id = 1; /// Unique identifier for a policy.
	string pname = 2; /// Policy name.
	int64 renew = 3; /// ADA checks for updated policy after renew period. Unit: milliseconds.
	int64 backup_window = 4; /// Number of transfer_windows in backup log. Unit: number.
	int64 delay = 5; /// Wait time from Application start before starting to process plans in the policy. Unit: milliseconds. 
	int64 timestamp = 6; /// Policy creation time. Unit - UTC epoch in milliseconds.
	repeated AdaPlan plans = 7; /// List of plans
}

message AdaPlan {
	int64 period = 1; /// Data collection frequency. Unit - milliseconds. 
	string type = 2; /// Plan type; Possible values { "poll", "event", "popup" }
	int64 transfer_window = 3; /// Number of samples to be collected in each upload bundle. Unit: number
	repeated AdaSignal signals = 4; /// List of signals / data points to be collected
	repeated AdaEvent event = 5; /// Event definition
}

message AdaSignal {
	string name = 1; /// Network API Signal Name or Kona Sensor Name or Diagnostics Command
	string type = 2; /// Type or source of data. Possible values { "kona", "napi", "location", "clock", "diag", "command" }
}

/// To be replaced by Stack Evaluator's event object
message AdaEvent {
	string signalName = 1; /// Signal or datapoint being compared. Same as AdaSignal.name
	string signalType = 2; /// Type or source of datapoint. Same as AdaSignal.type
	repeated string compareType = 3; /// Comparison type. Possible values { "threshold", "signal" }
	repeated string threshold = 4; /// Threshold value
	repeated string compareToSignals = 5; /// List of signals 
	repeated string comparators = 6; /// Possible values >, <, =, >=, <=. 
}

message AdaBundleEventEncrypted {
	string bundle = 1; /// Encrypted AdaBundleEvent
}