class BlockHeaderValidator {

  public boolean validateHeader(
      final BlockHeader header,
      final BlockHeader parent,
      final ProtocolContext protocolContext,
      final HeaderValidationMode mode) {
    switch (mode) {
      case NONE:
        return true;
      case LIGHT_DETACHED_ONLY:
        return applyRules(
            header,
            parent,
            protocolContext,
            rule -> rule.includeInLightValidation() && rule.isDetachedSupported());
      case LIGHT_SKIP_DETACHED:
        return applyRules(
            header,
            parent,
            protocolContext,
            rule -> rule.includeInLightValidation() && !rule.isDetachedSupported());
      case LIGHT:
        return applyRules(header, parent, protocolContext, Rule::includeInLightValidation);
      case DETACHED_ONLY:
        return applyRules(header, parent, protocolContext, Rule::isDetachedSupported);
      case SKIP_DETACHED:
        return applyRules(header, parent, protocolContext, rule -> !rule.isDetachedSupported());
      case FULL:
        return applyRules(header, parent, protocolContext, rule -> true);
    }
    throw new IllegalArgumentException("Unknown HeaderValidationMode: " + mode);
  }

  private  BlockHeaderValidator(final List<Rule> rules);

}