import conditionObjectBase from '../condition-object-base.js'

export default {
  ...conditionObjectBase,
  key: 'chapterIdLevel1',
  title: '',
  dependentKeys: ['chapterId'],
  isDependencyReady(params) {
    let depKey = this.dependentKeys[0]
    return params[depKey]
  },
  getList: function(param, vue) {
    let depKey = this.dependentKeys[0]
    let conditionList = vue.conditionsOutput.find(c => c.key == depKey)
    let matchItem = conditionList.list.find(l => l.code == param[depKey])
    return Promise.resolve(matchItem._raw.children)
  }
}
