import { ValueProcessorItem } from '..'
import { Action, Element } from '../../'
import helpers from '@/helpers'
import _ from 'lodash'

export default class CustomSelectProcessor implements ValueProcessorItem {
  public processValue(element: Element, index: number, rootState: any, rootGetters: any) {
    if (element.type === 'custom-select') {
      if (element.options !== undefined) {
        element.options = element.options.map(op => ({
          text: op.label,
          value: op.value,
        }))
      }

      element.type = 'select'
    }

    return element
  }
}
