package com.smartdevicelink.proxy.rpc;

import com.smartdevicelink.proxy.RPCStruct;
import com.smartdevicelink.proxy.rpc.enums.PrimaryAudioSource;

import java.util.Hashtable;
import java.util.List;

public class AudioControlData extends RPCStruct {
	public static final String KEY_SOURCE = "source";
	public static final String KEY_KEEP_CONTEXT = "keepContext";
	public static final String KEY_VOLUME = "volume";
	public static final String KEY_EQUALIZER_SETTINGS = "equalizerSettings";

	/**
	 * Constructs a newly allocated AudioControlData object
	 */
	public AudioControlData() {
	}

	/**
	 * Constructs a newly allocated AudioControlData object indicated by the Hashtable parameter
	 *
	 * @param hash The Hashtable to use
	 */
	public AudioControlData(Hashtable<String, Object> hash) {
		super(hash);
	}

	/**
	 * Sets the source portion of the AudioControlData class
	 *
	 * @param source In a getter response or a notification, it is the current primary audio source of the system.
	 *               In a setter request, it is the target audio source that the system shall switch to.
	 *               If the value is MOBILE_APP, the system shall switch to the mobile media app that issues the setter RPC.
	 */
	public void setSource(PrimaryAudioSource source) {
		setValue(KEY_SOURCE, source);
	}

	/**
	 * Gets the source portion of the AudioControlData class
	 *
	 * @return PrimaryAudioSource - In a getter response or a notification, it is the current primary audio source of the system.
	 * In a setter request, it is the target audio source that the system shall switch to.
	 * If the value is MOBILE_APP, the system shall switch to the mobile media app that issues the setter RPC.
	 */
	public PrimaryAudioSource getSource() {
		return (PrimaryAudioSource) getObject(PrimaryAudioSource.class, KEY_SOURCE);
	}

	/**
	 * Sets the keepContext portion of the AudioControlData class
	 *
	 * @param keepContext This parameter shall not be present in any getter responses or notifications.
	 *                    This parameter is optional in a setter request. The default value is false.
	 *                    If it is true, the system not only changes the audio source but also brings the default infotainment system UI associated with the audio source to foreground and set the application to background.
	 *                    If it is false, the system changes the audio source, but keeps the current application's context.
	 */
	public void setKeepContext(Boolean keepContext) {
		setValue(KEY_KEEP_CONTEXT, keepContext);
	}

	/**
	 * Gets the keepContext portion of the AudioControlData class
	 *
	 * @return Boolean - This parameter shall not be present in any getter responses or notifications.
	 * This parameter is optional in a setter request. The default value is false.
	 * If it is true, the system not only changes the audio source but also brings the default infotainment system UI associated with the audio source to foreground and set the application to background.
	 * If it is false, the system changes the audio source, but keeps the current application's context.
	 */
	public Boolean getKeepContext() {
		return getBoolean(KEY_KEEP_CONTEXT);
	}

	/**
	 * Sets the volume portion of the AudioControlData class
	 *
	 * @param volume Reflects the volume of audio, from 0%-100%.
	 */
	public void setVolume(Integer volume) {
		setValue(KEY_VOLUME, volume);
	}

	/**
	 * Gets the volume portion of the AudioControlData class
	 *
	 * @return Integer - Reflects the volume of audio, from 0%-100%.
	 */
	public Integer getVolume() {
		return getInteger(KEY_VOLUME);
	}

	/**
	 * Gets the equalizerSettings portion of the AudioControlData class
	 *
	 * @return List<EqualizerSettings> - Defines the list of supported channels (band) and their current/desired settings on HMI.
	 */
	@SuppressWarnings("unchecked")
	public List<EqualizerSettings> getEqualizerSettings() {
		return (List<EqualizerSettings>) getObject(EqualizerSettings.class, KEY_EQUALIZER_SETTINGS);
	}

	/**
	 * Sets the equalizerSettings portion of the AudioControlData class
	 *
	 * @param equalizerSettings Defines the list of supported channels (band) and their current/desired settings on HMI.
	 */
	public void setEqualizerSettings(List<EqualizerSettings> equalizerSettings) {
		setValue(KEY_EQUALIZER_SETTINGS, equalizerSettings);
	}

}

@@ -1992,37 +1992,24 @@
 cations.%0A%09 *
-             
        This 
@@ -2077,34 +2077,43 @@
 is false
-.%0A%09 *             
+ if it is not included.%0A%09 *
        I
@@ -2112,35 +2112,36 @@
        If it is 
-tru
+fals
 e, the system no
@@ -2196,36 +2196,48 @@
 the default 
-infotainment
+application or%0A%09 *      
  system UI a
@@ -2285,64 +2285,13 @@
 ound
- and set the application to background.%0A%09 *             
+.%0A%09 *
     
@@ -2294,36 +2294,35 @@
        If it is 
-fals
+tru
 e, the system ch
@@ -2311,32 +2311,37 @@
 rue, the system 
+only 
 changes the audi
@@ -2379,34 +2379,38 @@
  application
-'s context
+ in foreground
 .%0A%09 */%0A%09publ
@@ -2677,16 +2677,22 @@
 ons.%0A%09 *
+      
  This pa
@@ -2758,21 +2758,49 @@
 is false
-.%0A%09 *
+ if it is not included.%0A%09 *      
  If it i
@@ -2793,35 +2793,36 @@
        If it is 
-tru
+fals
 e, the system no
@@ -2885,20 +2885,32 @@
 ult 
-infotainment
+application or%0A%09 *      
  sys
@@ -2966,51 +2966,19 @@
 ound
- and set the application to background.%0A%09 *
+.%0A%09 *      
  If 
@@ -2975,36 +2975,35 @@
        If it is 
-fals
+tru
 e, the system ch
@@ -3000,16 +3000,21 @@
  system 
+only 
 changes 
@@ -3068,18 +3068,22 @@
 tion
-'s context
+ in foreground
 .%0A%09 

Update keepContext description