/**
 * <p class=proto-main>The Provisioning API supports the client requesting or the SDP pushing the vehicle provisioning information to the client.
 * The interface includes the read-only configuration data consumed by the client.  The Vehicle Data Sync interface supports the data elements which can be
 * modified in the vehicle and synchronized with the cloud.</p>
 *
 * <div class=proto-hier>
 * UconnectAny
 *   |---- <a href="#com.fca.uconnect.global.InitiateProvisioningPush">InitiateProvisioningPush  (1010)</a>
 *   |
 *   |---- <a href="#com.fca.uconnect.global.ProvisioningRequest">ProvisioningRequest  (1011)</a>
 *   |
 *   |---- <a href="#com.fca.uconnect.global.ProvisioningResponse">ProvisioningResponse  (1012)</a>
 *   |
 *   |---- <a href="#com.fca.uconnect.global.ProvisioningPush">ProvisioningPush  (1013)</a>
 *         |---- <a href="#com.fca.uconnect.global.ServiceSubscriptionInfo">ServiceSubscriptionInfo  (1020)</a>
 *         |      |
 *         |      |---- <a href="#com.fca.uconnect.global.ServiceDescription">ServiceDescription </a>
 *   |     |
 *   |     |---- <a href="#com.fca.uconnect.global.ProvisioningPush.Drm">DRM</a>
 *   |     |
 *   |     |---- <a href="#com.fca.uconnect.global.BIMDPSK">BIMDPSK  (1022)</a>
 *   |
 *   |---- <a href="#com.fca.uconnect.global.ProvisioningPushAck">ProvisioningPushAck (1014)</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.17</td><td>2018-05-25</td><td>Add DRM Hash Field</td></tr>
 *   <tr><td>1.16</td><td>2017-11-2</td><td>Removed unused messages, keeping only byte message</td></tr>
 *    <tr><td>1.15</td><td>2017-11-2</td><td>Update to Proto3</td></tr>
 *  <tr><td>1.14</td><td>2017-09-27</td><td>Update ProvisioningResponse and ProvisioningPushAck.</td></tr>
 *  <tr><td>1.13</td><td>2017-09-20</td><td>Added ReasonEnum to Provisioning Request, added Services back to ProvisioningPush .</td></tr>
 *  <tr><td>1.12</td><td>2017-08-11</td><td>Added ProvisioningPushAck Message.</td></tr>
 *  <tr><td>1.11</td><td>2017-08-07</td><td>modified BIMDPSK structure.</td></tr>
 *  <tr><td>1.10</td><td>2017-06-30</td><td>moved drmFile to COMMON.Drm.</td></tr>
 *  <tr><td>1.9</td><td>2017-06-30</td><td>added drmFile to ProvisioningPush.Drm.</td></tr>
 *  <tr><td>1.8</td><td>2017-06-30</td><td>Moved msisdn,imei,imei,iccid,tbmSerialNum,tbmFirmwareVersion,huSerialNum,huFirmwareVersion to Common Proto.</td></tr>
 *  <tr><td>1.7</td><td>2017-06-20</td><td>Added fields for Signature correlation Message to ProvisioningPush.</td></tr>
 *  <tr><td>1.6</td><td>2017-06-16</td><td>Added msisdn,imei,imei,iccid,tbmSerialNum,tbmFirmwareVersion,huSerialNum,huFirmwareVersion to ProvisioningRequest,added operationEnum & RegistrationStatusEnum to ProvisioningPush.</td></tr>
 *  <tr><td>1.5</td><td>2017-04-18</td><td>Added InitiateProvisioningPush Message and ConnectedVehicle service type</td></tr>
 *  <tr><td>1.4</td><td>2017-04-18</td><td>Added keyvalue Pair in Provisioning Request for modemId,TBM&HU Serial Number Firmware Version and other Ids. </td></tr>
 *  <tr><td>1.3</td><td>2017-04-03</td><td>Added Status to ServiceSubscriptionInfo </td></tr>
 *  <tr><td>1.2</td><td>2017-03-31</td><td>Added Key-value element to ServiceSubscriptionInfo </td></tr>
 *  <tr><td>1.1</td><td>2017-03-03</td><td>Signature extracted to Global_Uconnect_Ext_Signature.proto </td></tr>
 *	<tr><td>1.0</td><td>2017-02-14</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>fcasdp/${iot:ClientId}/PRVI</td></tr>
 *	 <tr><td>Cloud receive from Vehicle</td><td>Subscribe</td><td>fcasdp/PRVI/#</td></tr>
 *	 <tr><td>Vehicle send to Cloud </td><td>Publish</td><td>fcasdp/PRVI/${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/provisioning.png>
 *
 * <table class=sequence-table><thead><tr>
 *	<td>Sequence</td><td>Title</td><td>Role</td><td>Message</td><td>Topic</td><td>Description</td></tr></thead>
 *   <tbody>
 * <tr><td>1.</td><td>Send InitiateProvisioningPush Message</td><td>SDP</td><td>InitiateProvisioningPush</td><td>${iot:ClientId}/PRVI</td><td><p>The in-vehicle Provisioning event which triggers the client device to send a ProvisioningRequest to the SDP.</p></td></tr>
 * <tr><td>2.</td><td>ProvisioningEvent</td><td>TBM/HU</td><td></td><td></td><td><p>The in-vehicle Provisioning event which triggers the client device to send a ProvisioningRequest to the SDP.</p></td></tr>
 * <tr><td>3.</td><td>Assign MessageId</td><td>TBM/HU</td><td></td><td></td><td><p>The client generates the messageId for the message by incrementing a sequence counter.</p></td></tr>
 * <tr><td>4.</td><td>Send ProvisioningRequest Message</td><td>TBM/HU</td><td>ProvisioningRequest</td><td>/PRVI/${iot:ClientId}</td><td><p>The client populates the ProvisioningRequest Message with the  elements and publishes to the Provisioning topic.</p></td></tr>
 * <tr><td>5.</td><td>Process Message</td><td>SDP</td><td></td><td></td><td><p>The SDP processes the message and generates a ProvisioningResponse Message with the status and the correlationId set to the messageId from the received ProvisioningRequest Message.</p></td></tr>
 * <tr><td>6.</td><td>Send ProvisioningResponse Message</td><td>SDP</td><td>ProvisioningResponse</td><td>${iot:ClientId}/PRVI</td><td><p>The service publishes the response message to the Provisioning topic for the client to receive.</p></td></tr>
 * <tr><td>7.</td><td>Process Message</td><td>TBM/HU</td><td></td><td></td><td><p>The client receives the message and verifies the correlationId matches the messageId of the sent request.</p></td></tr>
 * <tr><td>8.</td><td>Send ProvisioningPush Message</td><td>SDP</td><td><p>ProvisioningPush</td><td>${iot:ClientId}/PRVI</td><td>Once the Provisioning is accepted after the appropriate out of band approval steps, the SDP will build a new ProvisioningPush Message with the  initial client configuration.  The correlationId set to the messageId from the received ProvisioningRequest Message.The service publishes the ProvisioningPush message to the Provisioning topic for the client to receive.</p></td></tr>
 * <tr><td>9.</td><td>Process Message</td><td>TBM/HU</td><td></td><td></td><td><p>The client receives the message and verifies the correlationId matches the messageId of the initially sent request.</p></td></tr>
 * <tr><td>10.</td><td>Send ProvisioningPushAc0k Message</td><td>TBM/HU</td><td>ProvisioningPushAck</td><td>/PRVI/${iot:ClientId}</td><td><p>The client acknowledges the ProvisioningPush Message with the ProvisioningPushAck Message publishes to the Provisioning topic.</p></td></tr>
 * <tr><td>11.</td><td>Process Message</td><td>SDP</td><td></td><td></td><td><p>The SDP processes the message .</p></td></tr>
 * </tbody>
 * </table>
 *
 */
 syntax="proto3";
package com.fca.uconnect.global;


//import public "Global_Uconnect_Control.proto";
import public "Global_Uconnect_Device.proto";
import public "Global_Uconnect_DRM.proto";

/**
* This message is to initiate a New Registration from SDP.
*
*<div class=exmsg-main>
* <h4>InitiateProvisioningPush Example Message:</h4>
 * <div class=ex-msg>
 *	<code>
 *		timestamp: 1488743306361
 * 		messageId: 2
 * 		messages
 * 		{
 * 		 [com.fca.uconnect.global.initiateProvisioningPush]
 * 		 {
 *
 * 		 }
 * 		}
 *  </code>
 * </div>
 *</div>
 */
message InitiateProvisioningPush{
 map<string,string> parameters = 1;
}
/**
* This message represents the vehicle's request for provisioning.
* This sequence is to be executed when the provisioning is triggered from the vehicle.
* Usually this happens when the IVI is installed to the vehicle and connected to the network for the first time
* or when the vehicle is sold to customer at the dealer or when an IVI unit is swapped for maintenance  purposes.
*<div class=exmsg-main>
* <h4>InitiateProvisioningPush Example Message:</h4>
 * <div class=ex-msg>
 *	<code>
 *		timestamp: 1526995301332
* 		messageId: 103
*		messages {
  *			initiateProvisioningPush {
 * 			}
*		}
 *  </code>
 * </div>
 *</div>
 *
* div class=exmsg-main>
* <h4>ProvisioningRequest Example Message:</h4>
 * <div class=ex-msg>
 *	<code>
		message ProvisioningRequest {
*		timestamp: 1526994892993
*       messageId: 301
*		messages {
*		  provisioningRequest {
*			vehicleId: "562X4423AE122"
*			device {
*				deviceType: TBM
*				tbmSerialNum: "000019928"
*				tbmPartNum: "0000400"
*				tbmHardwareVersion: "1.1.19"
*				tbmSoftwareVersion: "2.1"
*				simIccid: "52444223"
*				simImsi: "24423332"
*				simMsisdn: "443467446"
*				nadImei: "897080984"
*				nadHardwareVersion: "233314"
*				nadSoftwareVersion: "411312"
*				nadSerialNum: "2324224"
*				nadPartNum: "4244352"
*				}
*			}
*		}
 *</code>
 * </div>
 *</div>
*/

message ProvisioningRequest {
     string vehicleId = 1;/// VIN or other unique identifier for the vehicle this Telematics Unit is installed in.
    // Device device = 2;
	bytes DrmHash = 5; // Hash mark to determine if DRM on the SDP has changed
    map<string,string> additionalModemParams = 3;/// This can be used as key value pair for additional Modem Identifiers.
	 ReasonEnum reason = 4;
    enum ReasonEnum{
    	IGNITION_CYCLE_CHECK = 0; /// IGNITION_CYCLE_CHECK
    	TBM_FLASH= 1; /// TBM_FLASH
    	HU_FLASH = 2; /// HU_FLASH
    	ON_DEMAND = 3; /// ON_DEMAND
    	MISDN_MISMATCH = 4; /// MISDN_MISMATCH
    	DISCREPENCY_CHECK = 5; /// DISCREPENCY_CHECK
    	SOFTWARE_REFRESH = 6; /// SOFTWARE_REFRESH
    	HU_SWAP = 7; /// HU_SWAP
    	TBM_SWAP = 8; ///TBM_SWAP
    	ENROLLMENT = 9; /// ENROLLMENT
    	RETURN_TO_NEW = 10; ///
    	
    }
}


/**
* This message is sent as response to ProvisionRequest.
*<div class=exmsg-main>
*  <h4>ProvisioningResponse Example Message:</h4>
 * <div class=ex-msg>
 *	<code>
 *		timestamp: 1488746450628
 * 		messageId: 101
 * 		correlationId: 301
 * 		messages
 * 		{
 * 		 provisioningResponse
 * 		 {
 * 			responseEnum: SUCCESS
 * 		 }
 * 		}
 *  </code>
 * </div>
 *</div>
*/
message ProvisioningResponse {
	enum ResponseEnum {
		SUCCESS = 0;/// Response successful for provisioning.
		FAILURE = 1;/// Response failure for provisioning.
	}
	 ResponseEnum responseEnum = 1; /// Success or Failure Response
	 bool isTransient = 2; /// Indicates a transient error and a retry can be attempted.
	 int32 failureReasonCode = 3; /// Specific error code.
}
/**
 * This is for asynchronously pushing the provisioning with services  and/or BIMDPSKInfo.
 *<div class=exmsg-main>
 * <h4>ProvisioningPush Example Message:</h4>
 * <div class=ex-msg>
 *	<code>
 * 		timestamp: 1488828296489
 * 		messageId: 102
*		correlationId: 301
 * 		messages
 * 		{
 * 		provisioningPush
 * 		 {
 * 		   drm
 *         {
 *           drmFile:"fgnbooe8y73nfmlsi0iufnjej876reef=="
 * 		   }
 * 		 }
 * 		}
 * </code>
 * </div>
 *</div>
 */
message ProvisioningPush {
	 ServiceSubscriptionInfo serviceSubscription = 1;///Added Params to support APAC
	 DRM drm = 2;/// DRM content to support provisioning applications.
	 int64 timestamp = 3;///Added for signature correlation to message
	 int32 messageId = 4;///Added for signature correlation to message
	 int32 signatureId = 5;///Added for signature correlation to message
     BIMDPSKInfo bimdPSK = 6;///Provides TLS-PSK Tokens for secure connection with Mobile Devices.
}
/**
 * This message is to acknowledge ProvisioningPush message .
 *<div class=exmsg-main>
 * <h4>ProvisioningPushAck Example Message:</h4>
 * <div class=ex-msg>
 *	<code>
 * 		timestamp: 1488828296500
 * 		messageId: 302
 *		correlationId: 102
 * 		messages
 * 		{
 * 			provisioningPushAck
 * 		 {
 * 		   response:SUCCESS
 * 		 }
 * 		}
 * </code>
 * </div>
 *</div>
 */
message ProvisioningPushAck{
   enum ProvisioningPushResponseEnum{
   	SUCCESS = 0;
   	FAILURE = 1;
   }
   	 ProvisioningPushResponseEnum response = 1; /// Success or Failure Response
   	 bool isTransient = 2; /// Indicates a transient error and a retry can be attempted.
	 int32 failureReasonCode = 3; /// Specific error code.
}
///**
//* This Message represents the Service name and expiration time that Service is going to expire
//*/
message ServiceDescription{

	enum ServiceTypeEnum{
		WIFIHOTSPOT = 0;/// Wifi service.
        ECALL = 1;/// Emergency Call service.
        ROADSIDEASSIST = 2;///Road side assistance service.
        THEFTALARMNOTIFICATION = 3;/// This service notifies when Theft alarm is enabled.
        STOLENVEHICLEASSIST = 4;/// This is for stolen vehicle assistance.
        SENDDESTINATIONTOCAR = 5;/// This is for sending destination location to car.
        VEHICLEFINDER = 6;/// This service finds vehicle location.
        REMOTEDOORCONTROL = 7;/// This service enables Remote Door Lock/Unlock opertions.
        REMOTEENGINESTART = 8;/// This service enables Remote Start/Stop opertions.
        REMOTEHORNANDFLASH = 9;/// This service enables Remote Horn and lights opertions.
        RADIOPRESETS=10;///This Service enables Radio Presets.
		MUSICFAVORITES=11;///This service enables to favorite Songs/bands/Teams.
		TEMPERATURE=12;///This service enables Temperature settings.
		HEATEDCOOLEDSEATS=13;///This service enables Heating or cooling Seats.
		HEATEDSTEERINGWHEEL=14;///This service enables Heating Steering Wheel.
		CONNECTEDVEHICLE = 15; /// Connected Vehicle Service
		SQDF = 16; /// This service enables SQDF
		FTM = 17; /// This service enables Fleet Telematics 
		EVDATACHN = 18;///This service represents PHEV Data.
	}
	enum Status{
		INACTIVE = 0;///Service is not active.
		ACTIVE   = 1;///Service is active.
	}
	 ServiceTypeEnum serviceType=1;  /// The type of service being provisioned/activated
	 int64 expireTime=2; /// The service being provisioned/activated is considered active from the time this message is received until the expire time, expressed in milliseconds elapsed since 1 January 1970 00:00:00 UTC.
	map<string,string> additionalParameters = 3; ///This is for Configuration Parameters as a key-value pair like Call Center number,Server URL.
	 Status status = 4;/// This is to define whether service is Active/InActive.
	 int32 version = 5; /// Service version number 
	 int32 contentId = 6; /// Content ID
	 string appIdentifier = 7; /// Application ID
	 int32 appLauncherMask = 8; /// App Launcher Mask (auto start, manual)
	 string installerType = 9; /// Installer type 
	 string accountDN = 10; /// Account DN 
	 int32 fileLength = 11; /// fileLength
	 int32 fileChecksum = 12; /// Checksum data
	 string featureMask = 13; /// Feature Mask
	 int64 expirexTimeSpanBegiTimeSpanBegin = 14; /// DRM expiration Time Begin
	 int64 expireTimeSpanEnd = 15; /// DRM  Time Span End
	 string emailId = 16; ///Email ID
 }

/**
* This Message represents the list of Services that User can or may subscribed to.
*
* This message may be sent with an ProvisioningResponse or can be asynchronously at any time from the SDP.
*<div class=exmsg-main>
*  <h4>ServiceSubscriptionInfo  Example Message:</h4>
* <div class=ex-msg>
*	<code>
*		timestamp: 1488746451561
*		messageId: 4
*		messages
*		{
*		 [com.fca.uconnect.global.serviceSubscriptionInfo]
*		 {
*			services
*			{
*			  serviceType: ECALL
*			  expireTime: 1234567890
*			}
*			services
*			{
*			  serviceType: REMOTEENGINESTART
*			  expireTime: 1234567890
*			}
*		 }
*	   }
*   </code>
* </div></div>
*/
message ServiceSubscriptionInfo{
  repeated ServiceDescription services=1; /// The services enumerated in this message are enable from the time of receipt. All other services not explicitly listed are disabled immediately if possible, and upon the next ignition on cycle under all circumstances.
}


///This is for Authentication
message BIMDPSKInfo {
	message BIMDPSK{
	   string mobileDeviceId=1;///Device id for Mobile.
	   bytes preSharedKey=2 ;/// Repeated keys.
	}
	 repeated BIMDPSK deviceKeys=1;

}


// extend UconnectAny {
//	 InitiateProvisioningPush initiateProvisioningPush = 1010;
//     ProvisioningRequest provisioningRequest = 1011;
//     ProvisioningResponse provisioningResponse = 1012;
//     ProvisioningPush provisioningPush = 1013;
//     ProvisioningPushAck provisioningPushAck = 1014;

// }
