{"size": 879, "ext": "js", "max_stars_repo_path": "src/models/sections/historyEducation.js", "max_stars_repo_name": "ayompedb/culper", "max_stars_repo_stars_event_min_datetime": "2016-11-14T13:43:10.000Z", "max_stars_repo_stars_event_max_datetime": "2019-07-29T17:09:53.000Z", "max_issues_repo_path": "src/models/sections/historyEducation.js", "max_issues_repo_name": "ayompedb/culper", "max_issues_repo_issues_event_min_datetime": "2016-11-15T19:45:47.000Z", "max_issues_repo_issues_event_max_datetime": "2019-08-16T22:57:00.000Z", "max_forks_repo_path": "src/models/sections/historyEducation.js", "max_forks_repo_name": "ayompedb/culper", "max_forks_repo_forks_event_min_datetime": "2019-09-05T18:02:03.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-19T18:30:14.000Z"}
{"max_stars_count": 19, "max_issues_count": 1469, "max_forks_count": 10, "avg_line_length": 25.1142857143, "max_line_length": 78, "alphanum_fraction": 0.6211604096}
import { hasYesOrNo } from 'models/validate'
import education from 'models/education'

const historyEducation = {
  HasAttended: {
    presence: true,
    hasValue: { validator: hasYesOrNo },
  },
  HasDegree10: (value, attributes) => {
    // Only required if HasAttended is "No"
    if (attributes.HasAttended && attributes.HasAttended.value === 'No') {
      return {
        presence: true,
        hasValue: { validator: hasYesOrNo },
      }
    }

    return {}
  },
  List: (value, attributes) => {
    // Only required if either HasAttended or HasDegree10 is yes
    if ((attributes.HasAttended && attributes.HasAttended.value === 'Yes')
      || (attributes.HasDegree10 && attributes.HasDegree10.value === 'Yes')) {
      return {
        presence: true,
        accordion: { validator: education },
      }
    }

    return {}
  },
}

export default historyEducation
