# First-Time Live Approval

## Goal

Before a business uses Live the first time:

1. User must be **verified** (App2 / Foundation — `certified_by_istockhomes`).
2. Business must be **verified** (App2 / Foundation — `franchise.status` certified/Active).
3. Ask for **purpose** of Live use.
4. Store purpose for audit and future AI/moderator review.
5. Once approved, **do not ask again** unless purpose changes.

## Phase 2A implementation

| Item | Phase 2A |
|------|----------|
| Auth | **Yes** — App2 `auth.login` / `auth.me` / shared session |
| UI question flow | **Yes** — `go-live.php` |
| Persistence | `App/secure/live/approvals/{franchise_id}.json` (web-denied) |
| Production DB table | **Docs only** — Migration 023 **NOT EXECUTED** |
| Auto-approve when verified | Config flag `auto_approve_when_verified` (default true until moderator ships) |
| AI / human moderator | Hook designed; **not implemented** |

## Flow

```
Enter Go Live / Dashboard
    │
    ├─ Not signed in? → /live/signin.php → App2 auth.login
    │
    ├─ Missing verified user/business? → Message + link to App2
    │
    ├─ No approved purpose on file?
    │       → Ask purpose → store pending/approved
    │
    └─ Approved purpose on file
            → Show only: [Go Live Now] [Schedule Live]
```

## Purpose change rule

If the business submits a new purpose that differs from the approved purpose hash:

- Mark prior approval inactive / re-enter pending (future).
- Do not start Live until re-approved (enforcement expands in a later phase).

## Future AI/moderator hook (design only)

Inputs: purpose text, business category, verification status, prior Live history.  
Outputs: `approved` | `needs_human` | `denied` + reason codes.  
Admin UI shell reserved at `/live/admin/`.
