import { computed } from 'vendor';
import { isEmpty } from 'lodash';

class Validations {

  constructor(ux) {
    this.ux = ux;
  }

  get form() {
    return this.ux.form;
  }

  get plan() {
    return this.ux.plan;
  }

  @computed get isValid() {
    return !!this[this.ux.steps.currentStepId];
  }

  // tests
  @computed get details() {
    return Boolean(this.form && this.form.isValid);
  }

  @computed get chapters() {
    return !isEmpty(this.plan.pageIds);
  }

  @computed get questions() {
    return !isEmpty(this.plan.exerciseIds);
  }

  @computed get points() {
    return !isEmpty(this.plan.exerciseIds);
  }

  @computed get reorder() {
    return !isEmpty(this.plan.pageIds);
  }
}

export default Validations;

@@ -372,26 +372,102 @@
 m &&
- this.form.isValid
+%0A                   this.form.isValid &&%0A                   this.plan.tasking_plans.areValid()
 );%0A 

check tasking_plans for validity