import _ from 'lodash'
function resolver() {
  if (this._master_resolver !== null) {
    let masterKeysToResolve = this._masterKeysToResolve || []
    let masterKeyIdsToResolve = this._masterKeyIdsToResolve || []
    let masterKeyValues = _.chain(_.union(masterKeyIdsToResolve, masterKeysToResolve))
      .map(masterKey => {
        return this.$const.masterKey[masterKey] || masterKey
      })
      .value()
    let masterCountryGetterName = this._masterCountryGetterName
    this._master_resolver = this.$store.dispatch('loadMasterDataKeys', {
      masterCountryGetterName: masterCountryGetterName,
      keys: masterKeyValues,
    })
  }
  return this._master_resolver
}

export default resolver
