class RCUtils {

    public static void validateConnectionParms(HashMap<String, Object> parameters) throws RCException
    {
        if (!parameters.containsKey(RCConnection.ParameterKeys.CONNECTION_PEER) ||
                parameters.get(RCConnection.ParameterKeys.CONNECTION_PEER).equals("")) {
            throw new RCException(RCClient.ErrorCodes.ERROR_CONNECTION_MISSING_PEER);
        }
        if (parameters.containsKey(RCConnection.ParameterKeys.CONNECTION_VIDEO_ENABLED) &&
                (boolean)parameters.get(RCConnection.ParameterKeys.CONNECTION_VIDEO_ENABLED)) {
            // video call

            if (!parameters.containsKey(RCConnection.ParameterKeys.CONNECTION_LOCAL_VIDEO) ||
                    parameters.get(RCConnection.ParameterKeys.CONNECTION_LOCAL_VIDEO) == null ||
                    !parameters.containsKey(RCConnection.ParameterKeys.CONNECTION_REMOTE_VIDEO) ||
                    parameters.get(RCConnection.ParameterKeys.CONNECTION_REMOTE_VIDEO) == null) {
                throw new RCException(RCClient.ErrorCodes.ERROR_CONNECTION_VIDEO_CALL_VIEWS_MANDATORY);
            }
        }
        else {
            // audio-only call
            if (parameters.containsKey(RCConnection.ParameterKeys.CONNECTION_LOCAL_VIDEO)) {
                RCLogger.w(TAG, "validateConnectionParms(): WARN, local video  doesn't take effect since the call is audio-only" + parameters.toString());
            }

            if (parameters.containsKey(RCConnection.ParameterKeys.CONNECTION_REMOTE_VIDEO)) {
                RCLogger.w(TAG, "validateConnectionParms(): WARN, remote video doesn't take effect since the call is audio-only" + parameters.toString());
            }

            if (parameters.containsKey(RCConnection.ParameterKeys.CONNECTION_PREFERRED_VIDEO_CODEC)) {
                // should not throw exception because we 'll be breaking backwards compatibility pretty badly. Let's instead log this
                //throw new RCException(RCClient.ErrorCodes.ERROR_CONNECTION_AUDIO_CALL_VIDEO_CODEC_FORBIDDEN);
                RCLogger.w(TAG, "validateConnectionParms(): WARN, video codec doesn't take effect since the call is audio-only" + parameters.toString());
            }
            if (parameters.containsKey(RCConnection.ParameterKeys.CONNECTION_PREFERRED_VIDEO_RESOLUTION)) {
                //throw new RCException(RCClient.ErrorCodes.ERROR_CONNECTION_AUDIO_CALL_VIDEO_RESOLUTION_FORBIDDEN);
                RCLogger.w(TAG, "validateConnectionParms(): WARN, video resolution doesn't take effect since the call is audio-only" + parameters.toString());
            }
            if (parameters.containsKey(RCConnection.ParameterKeys.CONNECTION_PREFERRED_VIDEO_FRAME_RATE)) {
                //throw new RCException(RCClient.ErrorCodes.ERROR_CONNECTION_AUDIO_CALL_VIDEO_FRAME_RATE_FORBIDDEN);
                RCLogger.w(TAG, "validateConnectionParms(): WARN, video frame rate doesn't take effect since the call is audio-only" + parameters.toString());
            }

        }

    }

}