# Task 009 — Leads Module

## Objective

Implement lead capture, status workflow, assignment, and manual creation from CRM records.

## Scope

- Leads API and `LeadService`
- UI list (table/kanban) and detail
- Status transitions per `docs/07-leads-pipeline.md`
- Fire `N8N_WEBHOOK_LEAD_CREATED` when URL configured

**Out of scope:** Auto-create from inbox (Task 015/018).

## Requirements

1. Sources: manual, import, campaign, inbox, webhook (stub webhook for later).
2. Qualification notes and service interest tags.
3. Owner assignment and filters by status.

## Files to create or modify

| Path | Action |
|------|--------|
| `src/app/leads/**` | Create |
| `src/app/api/leads/**` | Create |
| `src/services/lead.service.ts` | Create |
| `src/lib/n8n.ts` | Webhook helper (stub) |
| `docs/07-leads-pipeline.md` | Sync |
| `docs/09-n8n-integration.md` | Lead payload |
| `docs/16-changelog.md` | Entry |

## Acceptance criteria

- [ ] Full lead CRUD and status changes
- [ ] n8n webhook called on create when env set
- [ ] List filters by status and owner

## Documentation updates required

- `docs/07-leads-pipeline.md`
- `docs/09-n8n-integration.md`
- `docs/16-changelog.md`
