/*
 * Experiment Actions
 *
 * Actions change things in your application
 * Since this boilerplate uses a uni-directional data flow, specifically redux,
 * we have these actions which are the only way your application interacts with
 * your application state. This guarantees that your state is up to date and nobody
 * messes it up weirdly somewhere.
 *
 * To add a new Action:
 * 1) Import your constant
 * 2) Add a function like this:
 *    export function yourAction(var) {
 *        return { type: YOUR_ACTION_CONSTANT, var: var }
 *    }
 */

import {
  SESSION_START,
  SETTINGS_PULLED,
  SPAWNER_READY,
  SPAWN_CONFIGURATION,
  SPAWNER_CANCELLED,
  SESSION_READY,
  SESSION_FINISH,
  SAVE_SESSION_STATS,
  PAGE_RESET,
  TRAINING_COMPLETE,
  OPEN_TRAINING_MODAL,
  CLOSE_TRAINING_MODAL,
  SET_TRAINING_MSG_FORM,
  SET_TRAINING_MSG,
  SHOW_TRAINING_MSG,
  HIDE_TRAINING_MSG,
  TRAINING_SESSION_FINISH,
  TRAINING_SESSION_READY,
  HIDE_REPLAY_SCREEN,
  SET_SESSION_MSG_FORM,
  SET_SESSION_MSG,
  OPEN_SESSION_MODAL,
  CLOSE_SESSION_MODAL,
} from './constants';

export function launchSession() {
  return {
    type: SESSION_START,
  };
}

export function settingsPulled(userExperiment) {
  return {
    type: SETTINGS_PULLED,
    userExperiment,
  }
}

export function spawnerReady() {
  return {
    type: SPAWNER_READY,
  }
}

export function spawnConfiguration() {
  return {
    type: SPAWN_CONFIGURATION,
  }
}

export function spawnerCancelled() {
  return {
    type: SPAWNER_CANCELLED,
  }
}

export function sessionReady() {
  return {
    type: SESSION_READY,
  }
}

export function sessionFinish() {
  return {
    type: SESSION_FINISH,
  }
}

export function pageReset() {
  return {
    type: PAGE_RESET,
  }
}

export function trainingComplete() {
  return {
    type: TRAINING_COMPLETE,
  };
}

export function openTrainingModal() {
  return {
    type: OPEN_TRAINING_MODAL,
  };
}

export function closeTrainingModal() {
  return {
    type: CLOSE_TRAINING_MODAL,
  };
}

export function setTrainingMsgForm(msg) {
  return {
    type: SET_TRAINING_MSG_FORM,
    msg
  };
}

export function setTrainingMsg() {
  return {
    type: SET_TRAINING_MSG,
  };
}

export function showTrainingMsg() {
  return {
    type: SHOW_TRAINING_MSG,
  };
}

export function hideTrainingMsg() {
  return {
    type: HIDE_TRAINING_MSG,
  };
}

export function trainingSessionFinish() {
  return {
    type: TRAINING_SESSION_FINISH,
  };
}

export function trainingSessionReady() {
  return {
    type: TRAINING_SESSION_READY,
  };
}

export function hideReplayScreen() {
  return {
    type: HIDE_REPLAY_SCREEN,
  };
}

export function setSessionMsg() {
  return {
    type: SET_SESSION_MSG,
  };
}

export function setSessionMsgForm(msg) {
  return {
    type: SET_SESSION_MSG_FORM,
    msg
  };
}

export function openSessionModal() {
  return {
    type: OPEN_SESSION_MODAL,
  };
}

export function closeSessionModal() {
  return {
    type: CLOSE_SESSION_MODAL,
  };
}
