const StateBase = require('./stateBase');
const API = require('./actions/index');
const AllState =require('./actions/util');
const system = require("../../system");
class Context {
  constructor(){
    this.stateBase=new StateBase(API);
    this.allState=AllState;
  }  

  async request(params){
    let methodName = this.allState[params.nextStatus];
    if(!methodName){
      return system.getResult(-1,`参数错误 状态码错误`);
    }
    let _self = this.stateBase.setState(methodName);
    return await _self.doAction(params); 
  }
}

module.exports=Context;