// NOTE: status of Recruitment Router (step != 2) -> 0 First state , no action (สถานะแรกสุด ยังมีกระบวนการใดๆ) / 1 State Success (ทำกระบวนการเสร็จสิ้น) / -1 State Unsuccess(ทำกระบวนการไม่เสร็จสิ้น) / 2 Skip(ข้ามกระบวนการ)
// NOTE: status of exam router (step = 2) -> 0 No Action(ยังไม่มีการกระทำใดๆ ทั้งสิ้น) It's First state / 1 Success(ทำข้อสอบสำเร็จ) / -1 Unsuccess(ทำข้อสอบไม่ผ่าน) / 2 Skip(ข้ามกระบวนการ) / -2 no authorize exam because exam before not pass(ไม่มีสิทธิ์ทำข้อสอบเนื่องจากทำข้อสอบชุดก่อนไม่ผ่าน) // 3 waiting for checking score // 10 Approve for Exam(ทำการยืนยันให้ทำข้อสอบ) // -10 Wait for approve examination(รอการอนุมัติการทำข้อสอบ)
class RecruitmentRouter{
  constructor(){
    this.router = []
    this.examrouter = []
    this.interviewstep = false
  }
  setRouter(obj){
    this.router = obj
  }
  clearRouter(){
    this.router = []
  }
  setExamRouter(obj){
    this.examrouter = obj
  }
  setInterviewStep(bool){
    if (bool == 1){
      this.interviewstep = true
    }
  }
  generateRouter(){
    let routeP1 = [{
      step: 1,
      status: 0,
      swlangcode: 'SW012939'
    }]
    let routeP2 = this.examrouter
    let routeP3 = [{
      step: 3,
      status: 0,
      swlangcode: 'SW012942'
    }]
    let routeP4 = []
    if (this.interviewstep){
      routeP4 = [{
        step: 4,
        status: 0,
        swlangcode: 'SW012986'
      },{
        step: 5,
        status: 0,
        swlangcode: 'SW012943',
        skipby: ''
      }]
    }
    let routeP5 = [{
      step: 6,
      status: 0,
      swlangcode: 'SW012945'
    },{
      step: 7,
      status: 0,
      swlangcode: 'SW012944'
    }]
    this.router = []
    this.router = this.router.concat(routeP1, routeP2, routeP3, routeP4, routeP5)
  }
  getRouter(){
    return this.router
  }
  count(){
    return this.router.length
  }
}


// let router = [{
//   step: '',
//   status: '',
//   skipby: ''
// }]

// NOTE: step1 -> apply for job step
// NOTE: step2 -> Examination step // can skip
// NOTE: step3 -> Approve for Candidate step
// NOTE: step4 -> Approve for Interview step
// NOTE: step5 -> Interview step // can skip
// NOTE: step6 -> Approve for new Hire step
// NOTE: step7 -> Hiring step