import JavaExecutor from "../executor/java.executor";
import JavascriptExecutor from "../executor/javascript.executor";
import LaunchScreenExecutor from "../executor/launch-screen.executor";
import ProcedureExecutor from "../executor/procedure.executor";
import { ActionsType } from "../enum/ActionsType";
import { ApplicationContext, ErrorException } from "@sankhyalabs/core";
export default class ExecutorFactory {
  constructor(actionType) {
    this.actionType = actionType;
    this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
  }
  get executor() {
    switch (this.actionType) {
      case ActionsType.LAUNCH_SCREEN:
        return new LaunchScreenExecutor();
      case ActionsType.JAVASCRIPT:
        return new JavascriptExecutor();
      case ActionsType.JAVA:
        return new JavaExecutor();
      case ActionsType.PROCEDURE:
        return new ProcedureExecutor();
      default:
        throw new ErrorException(this._application.messagesBuilder.getMessage("snkActionsButton.title.error", undefined), this._application.messagesBuilder.getMessage("snkActionsButton.action.nonExistentType", { actionType: this.actionType }));
    }
  }
}
