import * as Qti1Selectors  from "../parsers/qti1/selectors";
import * as Qti2Assessment from "../parsers/qti2/selectors";
import * as EdxAssessment  from "../parsers/edX/selectors";

function getParser(metaData){
  return {
    "QTI1": Qti1Selectors,
    "QTI2": Qti2Assessment,
    "EDX": EdxAssessment
  }[metaData.get('type')];
}

function makeSelector(name){
  return (state, props) => {
    var parser = getParser(state.assessment);
    if(!parser){return parser;} // Handle no assessment loaded 
    var func = parser[name];
    return func(state, props);
  };
}

// Selectors that will interact with the assessment data.
// All of these take state and props as parameters and just
// wrap a call to the selectors native to the assessment.
export const questions = makeSelector("questions");
export const outcomes = makeSelector("outcomes");
export const questionCount = makeSelector("questionCount");

@@ -319,12 +319,16 @@
 et('
-type
+standard
 ')%5D;
@@ -497,17 +497,16 @@
 t loaded
- 
 %0A    var

use standard instead of type