class ChecklistPlanner {

    public List<CheckSpec> getEffectiveCheckSpecs(final List<CheckSpec> checkOverrides) {
        Map<String, CheckSpec> overlaid = new LinkedHashMap<>();
        List<CheckSpec> overrides = new ArrayList<>();

        if (checkOverrides != null) {
            overrides.addAll(checkOverrides);
        }

        LOGGER.trace("[getEffectiveCheckSpecs] checkOverrides: {}", checkOverrides);

        // first accum checks selected via selected checklists
        getSelectedChecklists()
                // debug filter
                .filter(Util.traceFilter(LOGGER, "[getEffectiveCheckSpecs] selected checklist: {}"))
                // Stream<Checklist> -> Stream<CheckSpec>
                .flatMap(checklist -> checklist.getChecks().stream())
                // apply overrides to each base spec
                .map(base -> applyOverrides(overrides, base))
                // evaluate skip after override
                .filter(CheckSpec::notSkipped)
                // only accum once
                .forEachOrdered(checkSpec -> {
                    if (!overlaid.containsKey(checkSpec.getName())) {
                        overlaid.put(checkSpec.getName(), checkSpec);
                    }
                });

        List<CheckSpec> toReturn = new ArrayList<>(overlaid.values());

        LOGGER.trace("[getEffectiveCheckSpecs] selectedChecklistChecks: {}", toReturn);

        // stream overrides to identify remaining specs
        overrides.stream()
                // filter out skipped overrides
                .filter(CheckSpec::notSkipped)
                // filter out overrides that already applied
                .filter(spec -> overlaid.values().stream().noneMatch(spec::overrides))
                // find first base spec to override among inactive checklists
                .forEachOrdered(spec -> {
                    CheckSpec merged = inactiveChecklists.stream()
                            // Stream<Checklist> -> Stream<CheckSpec>
                            .flatMap(checklist -> checklist.getChecks().stream())
                            // select base specs that each override spec overrides
                            .filter(spec::overrides)
                            // take optional head and overlay with override, or return override itself
                            .findFirst()
                            .map(spec::overlay)
                            .filter(CheckSpec::notSkipped)
                            .orElse(spec);

                    if (merged.mustInherit()) {
                        CheckSpec extended = getAllChecklists()
                                .flatMap(checklist -> checklist.getChecks().stream())
                                .filter(merged::inherits)
                                .findFirst().map(merged::inherit).orElse(merged);
                        // if extended spec has impl, add it
                        if (extended.notAbstract()) {
                            toReturn.add(extended);
                        }
                    } else {
                        // if merged spec has impl, add it
                        if (merged.notAbstract()) {
                            toReturn.add(merged);
                        }
                    }
                });

        LOGGER.trace("[getEffectiveCheckSpecs] effective check specs: {}", toReturn);
        return toReturn;
    }

    public  ChecklistPlanner(final List<String> activeChecklistIds);

}