/**
 * <p class=proto-main>The  proto is to for PHEV(Plug in Hybrid Electric Vehicles).</p>
 *<div class=proto-hier>
 * UconnectAny
 * 	   |
 * 	   |---- <a href="#com.fca.uconnect.global.ChargeDataRequest">ChargeDataRequest chargeDataRequest </a>
 *     |
 * 	   |---- <a href="#com.fca.uconnect.global.ChargeDataPublish">ChargeDataPublish chargeDataPublish</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.8</td><td>2018-12-07</td><td>Added String version of schedule times in ChargeSchedule object</td></tr>
 * <tr><td>1.7</td><td>2018-11-13</td><td>Added Schedule for 520 requirements</td></tr>
 * <tr><td>1.6</td><td>2018-11-13</td><td>Added int32 Int_EstimatedTimeToCharge_LEV1 = 5; nt32 Int_EstimatedTimeToCharge_LEV2 = 6; per assembla 571</td></tr>
 * <tr><td>1.5</td><td>2018-10-19</td><td>Added ChargeScheduleEnable</td></tr>
 *    <tr><td>1.4</td><td>2017-11-2</td><td>Added Response Enumerations to the ChargeDataPublish</td></tr>
  *    <tr><td>1.3</td><td>2017-11-2</td><td>Added ChargeDataRequest and ChargeDataPublish, added BatteryVoltage to ChargeData</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-06-15</td><td>Added CommandMark and DatacollectionTimestamp</td></tr>
 *	<tr><td>1.0</td><td>2017-06-15</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}/PHEV</td></tr>
 *	 <tr><td>Cloud receive from Vehicle</td><td>Subscribe</td><td>fcasdp/PHEV/#</td></tr>
 *	 <tr><td>Vehicle send to Cloud </td><td>Publish</td><td>fcasdp/PHEV/${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 and the SDP:</p>
 *  <img class=img-border src=./images/phev.png>
 *
 */
syntax="proto3";
package com.fca.uconnect.global;
// import public "Global_Uconnect_Control.proto";

/**
 * <div class=exmsg-main>
 * <h4>PHEVData Example Message:</h4>
 * <div class=ex-msg>
 *	<code>
 * 		timestamp: 1497889690516
 * 		messageId: 1
 * 		messages {
 * 		[com.fca.uconnect.global.phevData]
 * 		{
 * 		 data: "\000\000\000\000\000\000\000\000\000\000\000\000\000"
 * 		 commandMark: VEHICLE_LOGIN
 * 		 dataCollectionTimestamp: 1497889690516
 * 		}
 * 	  }
 *  </code>
 * </div>
 *</div>
*/
message ChargeNowRequest {
	ChargeCommandEnum chargeCommand = 1;

    enum ChargeCommandEnum {
    	START_CHARGE = 0;
    	STOP_CHARGE = 1;
    }
}

message ChargeNowResponse {
	enum ResponseEnum {
		SUCCESS = 0; /// Success
		UNPLUGGED_FAILURE = 1; /// Vehicle Is Not Plugged in
		FAILURE = 2; /// General FAILURE
	}


	 ResponseEnum response = 5;
	 bool isTransient = 3; /// Indicates a transient error and a retry can be attempted.
	 int32 failureReasonCode = 4; /// Specific error code.
	 }


message ChargeDataRequest {
///	bytes serviceRequestID = 1;
}


message ChargeDataPublish {

	float BatteryLevel = 8; /// High voltage battery level in percent
	PublishEventEnum eventTrigger = 1;
	PlugStatus plugStatus = 2;
	Range rangeEstimates = 3;
	ChargeStatusEnum chargeStatus = 4; /// actual reported value of the ChargeSysStat can signal
	repeated ChargeSchedule chargeSchedules = 5; /// Only required once charge now and charge scheduling are implemented
	repeated ChargeScheduleV2 chargeSchedulesV2 = 10;
	ResponseEnum response = 9;

	enum ResponseEnum {
		SUCCESS = 0; /// Success
		UNPLUGGED_FAILURE = 1; /// Vehicle Is Not Plugged in
		FAILURE = 2; /// General FAILURE
		VEHICLE_DATA_NOT_AVAILABLE = 3;
	}

	enum ChargeStatusEnum {
		NOT_CHARGING = 0;
		CHARGING = 1;
		CHARGE_INTERRUPT= 2;
		CHARGE_FAULT = 3;
		CHARGE_COMPLETE = 4;
		SNA = 5;

	}
	message Range {
		int32 estimatedRange = 1; /// This is the estimated electric Range
		int32 totalRange = 2; /// TotalRange is the Hybrid Range including fuel
	}

	enum PublishEventEnum {
		IGNITION_ON = 0;
		IGNITION_OFF = 1;
		PLUGGED_IN = 2;
		UNPLUGGED = 3;
		CHARGE_START = 4;
		CHARGE_COMPLETED = 5;
		CHARGE_INTERRUPTED = 6;
		CHARGE_FAULTED = 7;
		ON_DEMAND = 8;
		CHARGE_SCHEDULE = 9;
	}
	 message PlugStatus {
	 	bool isPluggedIn = 1;
	 	ChargeLevel chargeLevel = 2;
	 	}

	message ChargeLevel {
		VoltageEnum chargeLevel = 2;
		string EstimatedTimeToCharge_LEV1 = 3;
		string EstimatedTimeToCharge_LEV2 = 4;
		int32 Int_EstimatedTimeToCharge_LEV1 = 5;
		int32 Int_EstimatedTimeToCharge_LEV2 = 6;

	}

	enum VoltageEnum {
 		DEFAULT = 0;
 		LEVEL_1 = 1;// Not expected to be used for China market
 		LEVEL_2 = 2;
	}
	}




message UpdateChargeSchedule {
	repeated ChargeSchedule updatedChargeSchedules = 1; /// Used for the RU and K8 for 2019.
	repeated ChargeScheduleV2 updateChargeShedulesV2 = 2; /// Used for Charge Schedules for 520 and after.


}

message ChargeScheduleV2 {
	bool EnableScheduleType = 1;
	ScheduleType scheduleType = 2;
	int32 StartTime = 3; /// follows HH:MM starting at 00:00. In example integer 530 would translate to 05:30 hours.
	int32 EndTime = 4; /// follows HH:MM starting at 00:00 - not required if ChargeToFull is True or if This is a climate schedule. In example integer 1030 would translate to 10:30 hours
	bool ChargeToFull = 5; // Used only for ChargeSchedules
	bool CabinPriority = 6; // Used only for Climate Schedules
	Days scheduledDays = 7;
	bool RepeatSchedule= 8;
	
	enum ScheduleType {
		NONE = 0;
		CHARGE = 1;
		CLIMATE = 2;
	}

	}

	message Days {
		bool isSunday = 1;
		bool isMonday = 2;
		bool isTuesday = 3;
		bool isWednesday = 4;
		bool isThursday = 5;
		bool isFriday = 6;
		bool isSaturday = 7;
	}

	





message ChargeSchedule {
	EnableChargeScheduleType enableChargeSchedule = 5;
	ScheduleTypeEnum scheduleType = 1;
	bool chargeUntilFull = 2;
	int32 scheduleStartTime = 3; ///Expressed as 00:00 to 23:00. In example integer 530 would translate to 05:30 hours.
	int32 scheduleEndTime = 4; /// Expressed as 00:00 to 23:00. In example integer 1030 would translate to 10:30 hours

		enum ScheduleTypeEnum {
		WEEKDAY = 0;
		WEEKEND = 1;
	}
enum EnableChargeScheduleType {
	DEFAULT=0;
	ENABLE_SCHEDULE = 1;
	DISABLE_SCHEDULE = 2;
}

}

//extend UconnectAny{
  //      PHEVData  phevData = 2010;
    //    AckMessage phevAckMessage=2011;
// }
