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

export default class CountryRelationsProcessor implements ValueProcessorItem {
  public processValue(element: Element, index: number, rootState: any, rootGetters: any) {
    if (element.key !== undefined && element.key !== 'master') {
      element.options = _.merge(
        rootGetters.getCountryRelationOptions(element.key),
        rootGetters.getCountryRelation(element.key)
      )
    }

    return element
  }
}
