# /campaign-report — Generate Campaign Performance Report

Build a comprehensive performance report for a lead generation campaign with metrics, insights, and recommendations.

## Usage

```
/campaign-report <campaign_id>            # Specific campaign
/campaign-report --all                    # All campaigns summary
/campaign-report --compare <id1> <id2>    # Side-by-side comparison
/campaign-report --format html|markdown   # Output format
```

## What This Command Does

### Step 1: Load Campaign Data
- Load campaign results from `LeadStore`
- Parse `CampaignResult` metrics (scraped, enriched, drafted, sent, failed)
- Load GDPR audit trail for compliance section
- Calculate derived metrics (conversion rates, velocity, quality scores)

### Step 2: Generate Report

```markdown
## Campaign Report: [Campaign ID]
**Period**: [Start] — [End]
**Status**: [Complete / In Progress]

---

### Executive Summary
[3-4 sentences: what happened, key result, main insight, next action]

### Key Metrics
| Metric | Value | Target | Status |
|--------|-------|--------|--------|
| Leads scraped | [N] | [N] | [Met/Missed] |
| Enrichment rate | [%] | 70% | [Met/Missed] |
| Emails drafted | [N] | [N] | [Met/Missed] |
| Send success rate | [%] | 95% | [Met/Missed] |
| Bounce rate | [%] | <5% | [Met/Missed] |

### Conversion Funnel
```
Scraped [N] ──→ Enriched [N] ([%]) ──→ Drafted [N] ([%]) ──→ Sent [N] ([%])
                    ↓                        ↓                      ↓
              Failed [N]              Skipped [N]             Failed [N]
```

### Source Analysis
| Source | Leads | Enrichment Rate | Best For |
|--------|-------|-----------------|----------|
| UK Companies House | [N] | [%] | [Insight] |
| Qatar QFC | [N] | [%] | [Insight] |
| Qatar Chamber | [N] | [%] | [Insight] |

### Content Performance
| AI Provider | Emails Generated | Avg Length | Tone |
|------------|-----------------|------------|------|
| [Provider] | [N] | [words] | [Setting] |

### GDPR Compliance
| Check | Status |
|-------|--------|
| Audit trail complete | [Pass/Fail] |
| Legal basis documented | [Pass/Fail] |
| Unsubscribe headers | [Pass/Fail] |
| Suppression list checked | [Pass/Fail] |

### Issues & Errors
| Issue | Count | Impact | Resolution |
|-------|-------|--------|------------|
| [Error type] | [N] | [Description] | [Fix] |

### Recommendations
1. **[Recommendation]** — Based on [data point], suggest [action]
2. **[Recommendation]** — Based on [data point], suggest [action]
3. **[Recommendation]** — Based on [data point], suggest [action]

### Next Steps
- [ ] [Action item 1]
- [ ] [Action item 2]
- [ ] [Action item 3]
```

### Step 3: Export Options
- **Markdown**: Direct terminal output
- **HTML**: Self-contained dashboard with charts (uses data-viz skill)
- **CSV**: Raw metrics for spreadsheet analysis

## Integration

- Uses `LeadStore.load_leads()` and `CampaignResult`
- Loads `GDPRAuditEntry` for compliance section
- Can generate charts using the data-viz skill
- Maps to `lead_pipeline export <campaign_id>` CLI command
