# Demo Data Reset and Reseed Foundation

## Purpose
This foundation package adds a repeatable way to clear demo/business data and rebuild the app with a fresh connected demo dataset.

The goal is to support the next seed passes where demo data will be rebuilt around realistic scenarios instead of ad hoc test records.

## New commands

### Check demo reset readiness before clearing data
```bash
npm run demo:readiness:foundation
```

This command:
- verifies DATABASE_URL is present
- verifies the required demo and seed source files still exist
- verifies the key demo scripts are declared in package.json
- verifies public schema visibility and a basic seeded baseline
- exits non-zero if reset or reseed prerequisites are broken

### Verified reset and reseed
```bash
npm run demo:reseed:verified
```

This command:
- runs the demo readiness check first
- only continues into the foundation reseed flow when readiness passes
- gives operators one safer command for repeated demo rebuilds


### Clear all current business/demo data
```bash
npm run demo:reset:foundation
```

This command:
- clears all public PostgreSQL tables except Prisma migrations
- leaves the schema in place
- does not reseed automatically

### Clear all current business/demo data and run the current canonical seed again
```bash
npm run demo:reseed:foundation
```

This command:
- clears all public PostgreSQL tables except Prisma migrations
- re-runs the existing canonical seed pipeline
- gives the app a clean baseline before the next scenario-driven demo data passes

## Why this is foundation only
This package does **not** yet introduce the new realistic demo scenarios.

It prepares for them by giving the project:
- a repeatable reset path
- a repeatable reseed path
- a clean way to remove old seeded data and manual test data before new connected demo scenarios are added

## Demo scenarios planned for the next seed passes
The next reseed passes should build realistic connected records across:
- ready trucks with no loads
- matching available loads
- driver conflict
- truck conflict
- in-transit loads
- delivered but uninvoiced loads
- invoiced but unpaid loads
- paid loads
- missing document loads
- compliance blockers
- billing follow-up queues
- collections follow-up queues
- CRM follow-ups and active pipeline examples
- dashboard, dispatch, billing, and documents page signals that all tie back to the same records

## Recommended usage order
1. Build and deploy the current package
2. Run `npm run demo:reseed:foundation` once to verify the new reset/reseed commands work on the live server
3. Proceed with the next seed passes to replace the current demo dataset with scenario-driven demo data

## Next step after foundation
Use the phase 1 realistic scenario seed pack when you are ready for a cleaner connected demo dataset:
```bash
npm run demo:reseed:scenario:phase1
```
