import { ValueProcessorItem } from '..'
import { Element } from '../../'

export default class RadioProcessor implements ValueProcessorItem {
  public processValue(element: Element, index: number, rootState: any, rootGetters: any) {
    if (element.type === 'radio') {
      element.value = element.value || element.id || index + 1

      element.selected = element.selected || false
    }

    return element
  }
}
