package com.smartdevicelink.proxy.rpc;

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

import java.util.Hashtable;

/**
 * Struct that indicates the a SystemCapabilityType and houses different structs to describe particular capabilities
 */

public class SystemCapability extends RPCStruct {
    public static final String KEY_SYSTEM_CAPABILITY_TYPE = "systemCapabilityType";
    public static final String KEY_NAVIGATION_CAPABILITY = "navigationCapability";
    public static final String KEY_PHONE_CAPABILITY = "phoneCapability";

    public SystemCapability(){}

    public SystemCapability(Hashtable<String, Object> hash) {
        super(hash);
    }

    /**
     *
     * @return The SystemCapabilityType that indicates which type of data should be changed and identifies which data object exists in this struct. For example, if the SystemCapability Type is NAVIGATION then a "navigationCapability" should exist
     */
    public SystemCapabilityType getSystemCapabilityType(){
        return (SystemCapabilityType) getObject(SystemCapabilityType.class, KEY_SYSTEM_CAPABILITY_TYPE);
    }

    /**
     * @param value Set the SystemCapabilityType that indicates which type of data should be changed and identifies which data object exists in this struct.
     */
    public void setSystemCapabilityType(SystemCapabilityType value){
        setValue(KEY_SYSTEM_CAPABILITY_TYPE, value);
    }

    public RPCStruct getCapabilityForType(SystemCapabilityType type){
        if(type.equals(SystemCapabilityType.NAVIGATION)){
            return (RPCStruct) getObject(NavigationCapability.class, KEY_NAVIGATION_CAPABILITY);
        }else if(type.equals(SystemCapabilityType.PHONE_CALL)){
            return (RPCStruct) getObject(PhoneCapability.class, KEY_PHONE_CAPABILITY);
        }else{
            return null;
        }
    }

    public void setCapabilityForType(SystemCapabilityType type, RPCStruct capability){
        if(type.equals(SystemCapabilityType.NAVIGATION)){
            setValue(KEY_NAVIGATION_CAPABILITY, capability);
        }else if(type.equals(SystemCapabilityType.PHONE_CALL)){
            setValue(KEY_PHONE_CAPABILITY, capability);
        }else{
            return;
        }
    }
}

@@ -587,16 +587,108 @@
 bility%22;
+%0A    public static final String KEY_VIDEO_STREAMING_CAPABILITY = %22videoStreamingCapability%22;
 %0A%0A    pu
@@ -1915,32 +1915,207 @@
 NE_CAPABILITY);%0A
+        %7Delse if(type.equals(SystemCapabilityType.VIDEO_STREAMING))%7B%0A            return (RPCStruct) getObject(VideoStreamingCapability.class, KEY_VIDEO_STREAMING_CAPABILITY);%0A
         %7Delse%7B%0A 
@@ -2473,32 +2473,167 @@
 Y, capability);%0A
+        %7Delse if(type.equals(SystemCapabilityType.VIDEO_STREAMING))%7B%0A            setValue(KEY_VIDEO_STREAMING_CAPABILITY, capability);%0A
         %7Delse%7B%0A 

Add video streaming capability in SystemCapability