package com.freeleaps.devops

import com.freeleaps.devops.enums.SASTScannerTypes
import com.freeleaps.devops.sast.SASTScanner
import com.freeleaps.devops.sast.Bandit

class SASTExecutor {
  def steps
  def workspace
  def scannerType

  SASTExecutor(steps, workspace, scannerType) {
    this.steps = steps
    this.workspace = workspace
    this.scannerType = scannerType
  }

  def execute() {
    SASTScanner scanner

    switch (scannerType) {
      case SASTScannerTypes.BANDIT:
        scanner = new Bandit(steps, workspace)
        break
      default:
        steps.error("Unsupported SAST scanner type: ${scannerType}")
        return
    }

    scanner.scan()
  }
}