# TODO

## Task: Extend `@ReportableMap` to support complex (POJO) values

Plan: `/home/aljunggren/.claude/plans/i-would-like-to-structured-kazoo.md`

- [x] Add `HeaderSpan` data class (`src/main/java/io/ljunggren/report/generator/HeaderSpan.java`)
- [x] Extract shared column-comparator logic in `Generator.order(...)` into a reusable helper (`sortByColumn`)
- [x] Add `resolveMapValueMembers(Object value)` type-classification helper in `Generator.java`
- [x] Build per-key `mapKeyMembers` metadata cache from row 0, once, in `Generator` constructor
- [x] Update `generateHeaders` to emit key + blank padding per complex entry, and record `HeaderSpan`s
- [x] Update `getItemsFromReportable` to expand nested `@Reportable` members using cached metadata
- [x] Fix/generalize `getAutoSizedColumns` map branch for variable columns-per-key
- [x] Update `ExcelGenerator.setHeaders` to merge header cells per `HeaderSpan` (POI `CellRangeAddress`)
- [x] Add test fixtures + tests (CSV): padding, nested formatting, null value alignment, fallback for unannotated value classes
- [x] Add test fixtures + tests (Excel): merged region assertions, nested formatting applied
- [x] Run full test suite (`mvn test`) and confirm existing `ReportableMap` tests still pass — 91/91 passing
- [x] Manual verification: generated a workbook from the `users` example (scratch script) — confirmed merged region A1:B1 with key "user1" as header, firstName/lastName as the two data cells beneath it
- [x] Document complex map value support in README.md (`@ReportableMap` section) — verified behavior against `Generator.java`, `ReportableMap.java`, `Reportable.java`, `ExcelGenerator.java`, and the CSV/Excel complex-value test classes

## Notes
- Simple values (boxed primitive/String) and value classes with zero `@Reportable` members both fall back to today's single-column behavior — confirmed with user.
- CSV: no cell merging exists, so padding the header list with blank strings (`key`, `""`, `""`, ...) already produces the agreed layout — no CSVGenerator code changes expected.
