/**
  * <script type="text/javascript" src="rawdeflate.js"></script>
* <script type="text/javascript" src="jquery.js"></script>
* <script type="text/javascript" src="jquery_plantuml.js"></script>
*
 * <p class=proto-main>This API is to upload Data Gathered for Personal Profile Settings .</p>
 *
 * UconnectAny
 *  |
*   |---- <a href="#com.fca.uconnect.global.PersonalProfile"> RequestProfileInfo  requestProfileInfo </a>
 *  |---- <a href="#com.fca.uconnect.global.PersonalProfile"> RequestProfileInfoResponse  requestProfileInfoResponse </a>
 *  |---- <a href="#com.fca.uconnect.global.PersonalProfile"> RequestProfileCategories  requestProfileCategories </a>
 *  |---- <a href="#com.fca.uconnect.global.PersonalProfile"> RequestProfileCategoriesResponse  requestProfileCategoriesResponse </a>
 *  |---- <a href="#com.fca.uconnect.global.PersonalProfile"> PublishProfileData  publishProfileData </a>
 *  |---- <a href="#com.fca.uconnect.global.PersonalProfile"> PublishProfileDataResponse  publishProfileDataResponse </a></p><p></div></p><p> <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></p><p> <tr><td>1.3</td><td>2019-09-20</td><td>Breaking Changes per cooperative agreement with Harman and onBoard Teams, restructured and renamed messages</td></tr>
*  <tbody></p><p> <tr><td>1.2</td><td>2019-05-23</td><td>Adjusted category enumerations per Abdullah</td></tr>
* <tr><td>1.1</td><td>2019-05-11</td><td>Adjusted per requirements</td></tr>
  * <tr><td>1.0</td><td>2019-02-11</td><td>First Creation</td></tr></p><p>	</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}/PRFL</td></tr>
 *	 <tr><td>Cloud receive from Vehicle</td><td>Subscribe</td><td>fcasdp/PRFL/#</td></tr>
 *	 <tr><td>Vehicle send to Cloud </td><td>Publish</td><td>fcasdp/PRFL/${iot:ClientId}</td></tr>
 *	 <tr><td>Vehicle receive from Cloud </td><td>Subscribe</td><td>fcasdp/${iot:ClientId}/PRFL</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 and the SDP:</p>
 *
 * <img class=img-border src='images/PersonalProfile.png' />
 *
 *
 */
syntax="proto3";
package com.fca.uconnect.global;
import "Global_Uconnect_Ext_Auth.proto";
import "Global_Uconnect_GNSS.proto";


//import public "Global_Uconnect_Control.proto";
/**
 * This message is to upload personalization data.
 * <div class=exmsg-main>
 * <h4>PersonalPages Example Message:</h4>
 * <div class=ex-msg>
 *	<code>
 *  timestamp: 1508946513018
 *  messageId: 1
 *  messages {
 *  [com.fca.uconnect.global.PublishProfileData] {
 *    TBD ]
 *     }
 * }
 *	</code>
 * </div>
 * </div>
 */



message RequestProfileInfo {
	string token= 1;
	string version = 2;

}

message RequestProfileInfoResponse {
enum StatusEnum {
	NO_NEW_CHANGES = 0;
	NEW_CHANGES_AVAILABLE = 1;
	PROFILE_DOESNT_EXIST = 2;
	FAILED_UNKOWN = 3;
	FAILED_TOKEN_INVALID = 4;
	FAILED_VEHICLE_BLACKLISTED = 5;

}

string  profileVersion = 2;
StatusEnum profileStatus = 3;
InfoCategories categories = 4; // This field is populated only when profileStatus= NEW_CHANGES_AVAILABLE

}

message InfoCategories {
CategoryEnum category = 2;
string version = 3;

enum CategoryEnum {
	DEFAULT_NULL = 0;
	VEHICLE_SETTINGS = 1;
	VR_SETTINGS = 2;
	SEAT_SETTINGS = 3;
	AUDIO_SETTINGS = 4;
	RADIO_SETTINGS = 5;
	PRESETS_SETTINGS = 6;
	APP_DRAWER_SETTINGS = 7;
	NAVIGATION_SETTINGS = 8;
}

}



message RequestProfileCategories {
	repeated InfoCategories infoCategory = 2; /// Repeatable object to request a category
	string token = 1;
}

enum CategoryResponse {
 	CATEGORY_UPDATE_SUCCESS = 0;
 	CATEGORY_NOT_FOUND = 1;
 	UNKOWN_FAILURE = 3;
 	TOKEN_INVALID_CAT = 4;

}

message RequestProfileCategoriesResponse {
repeated CategoryData categoryData = 1; /// only categories with a different version than what is supplied by the client have their data returned

message CategoryData {
	InfoCategories.CategoryEnum category = 1;
	string version = 3;
	DataMap.DataValues dataValues = 4;
	int64 timestamp = 5;


}


}


message RequestProfileDisconnect {
	ProfileActionEnum action = 1; //
	string userId = 2; //

enum ProfileActionEnum {
	DEFAULT_ACTION = 0;
	DISCONNECT_PROFILE = 1;
	DISCONNECT_AND_DELETE_PROFILE = 2;
}

}

message RequestProfileDisconnectResponse {
	ProfileManagmentEnum status = 1;

	enum ProfileManagmentEnum {
	NONE = 0;
	SUCCESS_DISCONNECT_PROFILE = 1;
	SUCCESS_DISCONNECT_AND_DELETE_PROFILE = 2;
	FAILED_PROFILE_NOT_FOUND = 3;
	FAILED = 4;
}
}

message RequestProfileDelete { /// this API requests a global deletion of the profile from all vehicles
	string token = 2;
}

message RequestProfileDeleteResponse {
	GlobalProfileStatusEnum status = 1;

	enum GlobalProfileStatusEnum {

		SUCCESS = 0;
		FAILED_PROFILE_NOT_FOUND = 1;
		FAILED_UNKNOWN = 2;

		}
}

message PublishProfileData {
		int64 timestamp = 5;/// UTC Timestamp in milliseconds set by the client
		string token = 6;
		string version = 7;
		repeated DataMap dataDelta = 8;


		}

message PublishProfileDataResponse {
/** Additional enumerations should be available, based on backend responses i.e. NOT_AUTHORIZED, NOT_REGISTERED etc */


	enum ResponseEnum{
		SUCCESS = 0; ///Success
		FAILED_NEW_VERSION_AVAILABLE = 1; /// Failure
		FAILED_UNKNOWN = 2;
		FAILED_TOKEN_INVALID = 3;
		FAILED_VEHICLE_BLACKLISTED = 4;


}
	ResponseEnum response = 1; /// Success or Failure
	string version = 2;
	repeated InfoCategories infoCategory = 3;


	}

message DataMap {
  RequestProfileCategoriesResponse.CategoryData category = 1;
  string categoryVersion = 3;
  repeated DataValues dataValues = 2; /// repeated once per key value pair in category

message DataValues {
  double timestamp = 1;
  string key = 2;
  string value = 3; // alternatively, the "value could be a  byte field
}
}
