/**
 * <p class=proto-main>This API is to notify the AOTA client of an update.  The AOTA client will manage downloading the update most likely through a different channel (https).</p>
 *
 * <div class=proto-hier>
 *   UconnectAny
 *     |
 *     |---- <a href="#com.fca.uconnect.global.InitiateDiscrepancyCheck">InitiateDiscrepancyCheck initiateDiscrepancyCheck</a>
 *     |
 *     |---- <a href="#com.fca.uconnect.global.DiscrepancyCheck">DiscrepancyCheck discrepancyCheck </a>
 *     |
 *     |---- <a href="#com.fca.uconnect.global.ApplicationUpdateNotification">ApplicationUpdateNotification applicationUpdateNotification </a>
 *     |
 *     |---- <a href="#com.fca.uconnect.global.UpdateStatusNotification">UpdateStatusNotification updateStatusNotification</a>
 * </div>
 *  <h3 class=change-log-hdr> Change Log</h3>
 *  <table id="change-log" class="change-log"><thead><tr>
 *	<td>Version</td><td>Date</td><td>Notes</td></tr></thead>
 *   <tbody>
*    <tr><td>1.4</td><td>2018-06-26</td><td>Added status enumerations to separately identify Download and Install status</td></tr>
* <tr><td>1.3</td><td>2018-05-21</td><td>Updated Sequence Diagram, minor documentation updates</td></tr>
  *    <tr><td>1.2</td><td>2017-11-2</td><td>Update to Proto3</td></tr>	
 *	<tr><td>1.1</td><td>2017-09-27</td><td>Update Notification response</td></tr>
 *	<tr><td>1.0</td><td>2017-07-11</td><td>Release of initial Proto</td></tr>
 *	</tbody></table>
 *
 *  <h3 class=change-log-hdr>List of MQTT Topics</h3>
 *  <table class="change-log"><thead><tr>
 *	<td>Flow</td><td>Type</td><td>Topic Name</td></tr></thead>
 *    <tbody>
 *   <tr><td>Cloud send to Vehicle</td><td>Publish</td><td>fcasdp/${iot:ClientId}/AOTA</td></tr>
 *	 <tr><td>Cloud receive from Vehicle</td><td>Subscribe</td><td>fcasdp/AOTA/#</td></tr>
 *	 <tr><td>Vehicle send to Cloud </td><td>Publish</td><td>fcasdp/AOTA/${iot:ClientId}</td></tr>
 *	 <tr><td>Vehicle receive from Cloud </td><td>Subscribe</td><td>fcasdp/${iot:ClientId}/#</td></tr>
 *	</tbody></table>
 * <h3 class=change-log-hdr>Data Flow</h3>
 *
 * <p class=proto-main>The following sequence diagram depicts the flow of messages between the TBM/HU and the SDP:</p>
 *
 * <img class=img-border src=./images/aota.png>
 *

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


//import public "Global_Uconnect_Control.proto";
import public "Global_Uconnect_DRM.proto";
/**
 * This message is for SDP to request TBM/HU to initiate DescrepancyCheck for updates.
 * <div class=exmsg-main>
 * <h4>InitiateDescrepancyCheck Example Message:</h4>
 * <div class=ex-msg>
 *	<code>
 * 		timestamp: 1490885867532
 * 		messageId: 11
 * 		messages
 * 		{
 * 		 [com.fca.uconnect.global.initiateDescrepancyCheck]
 * 		  {
 *  	  }
 * 		}
 *	</code>
 *   </div>
 * </div>
 */
message InitiateDiscrepancyCheck{
 map<string,string> parameters = 1;
}
/**
 * This message is to check if there is an update available for Application.
 */
message DiscrepancyCheck{

 bytes drmFile = 1;/// This is the base64 encoded DRM File sent for the discrepancy check.
repeated ApplicationInventory applicationInventory = 2;
}


message ApplicationInventory {

  string  appId = 4 ;///Application identifier which is unique.
  string  version = 2;///Version of the Firmware that needs to be downloaded.
  string  description = 3;///Description to be displayed to the User
  }
/**
 * This message is to Push the Application to Client when there is an update available.
 * <div class=exmsg-main>
 * <h4>ApplicationUpdateNotification Example Message:</h4>
 * <div class=ex-msg>
 *	<code>
 * 		timestamp: 1490885867532
 * 		messageId: 11
 * 		messages
 * 		{
 * 		 [com.fca.uconnect.global.applicationUpdateNotification]
 * 		  {
 * 			version: "2.0"
 * 			description: "Update for ABC"
 * 			expireDate: 360000
 * 			packageSize: 10000
 * 			url: "https://abc.com"
 * 			checksum: "CE114E4501D2F4E2DCEA3E17B546F339"
 *  	  }
 * 		}
 *	</code>
 *   </div>
 * </div>
 */
message ApplicationUpdateNotification{
  string  appId = 1;///Application identifier which is unique.
  string  version = 2;///Version of the Firmware that needs to be downloaded.
  string  description = 3;///Description of the application
  int64   expireDate = 4;///Time till when the Software is available for update.
  int32   packageSize = 5;///Size of the Application.
  string  url = 6;///URL to download the App update.
  string  checksum = 7;///Checksum of the FW package is to ensure integrity of downloading.
  string  token = 8;///Token which will be sent to download server to download the App.
}

/**
 * This message is to respond to SDP after Client installs Application Updates.
 *<div class=exmsg-main>
 * <h4>UpdateStatusNotification Example Message:</h4>
 * <div class=ex-msg>
 *	<code>
 * 		timestamp: 1490885867676
 * 		messageId: 1
 * 		correlationId: 11
 * 		messages
 * 		{
 * 		 [com.fca.uconnect.global.updateStatusNotification]
 * 		 {
 * 			status: SUCCESS
 * 		 }
 * 		}
 *	</code>
 *   </div></div>
 */
message UpdateStatusNotification {

 enum StatusEnum {
			SUCCESS_DOWNLOAD = 0;///Downloaded Successfully.
			FAILURE_DOWNLOAD = 1;///Download failed from download server.
			UPTODATE = 4;/// This Software update is already installed.
			SUCCESS_INSTALL = 5; ///Installation Successful
			FAILURE_INSTALL = 6; /// Application installation failed.
			SUCCESS_UNINSTALL = 7; ///Application Uninstallation Successful
			FAILURE_UNINSTALL = 8; /// Application Uninstallation failed.
		}
		 StatusEnum status = 1; /// Indicator for the status of the Software.
		 bool isTransient = 2; /// Indicates a transient error and a retry can be attempted.
		 int32 failureReasonCode = 3; /// Specific error code.
		 string appId = 4; /// assigned ID for an application

}

//extend UconnectAny{
	// InitiateDiscrepancyCheck initiateDiscrepancyCheck=500;
	 // DiscrepancyCheck discrepancyCheck=501;
	 // ApplicationUpdateNotification applicationUpdateNotification=502;
	 // UpdateStatusNotification updateStatusNotification=503;
	 // AckMessage ackMessage=504;
// }

