# Venue + Match Director profile storage

The match-builder skill persists venue and MD details between sessions so a director who runs the same club's match every month doesn't re-type the same info every time.

## Location

```
~/Documents/Match Day/profiles/
  ├── venues/
  │   ├── brazos-valley-shooting-club.json
  │   ├── tri-county-gun-club.json
  │   └── ...
  └── directors/
      ├── jory-hanus.json
      └── ...
```

The skill auto-creates the `~/Documents/Match Day/profiles/{venues,directors}/` tree on first save. **Don't** write profiles inside the skill folder — the skill is meant to be re-installable, and user data shouldn't get overwritten by an update.

## Venue profile shape

```json
{
  "slug": "brazos-valley-shooting-club",
  "name": "Brazos Valley Shooting Club",
  "address": "Bryan, TX 77803",
  "rules": "USPSA handgun. Major power factor only. Holsters must be Level 3+.",
  "parking": "Gravel lot, east side of range. Limited to ~20 vehicles.",
  "restrooms": "Portable restrooms at clubhouse.",
  "contact": "MD: Jory Hanus, (979) 555-1234",
  "createdAt": "2026-05-25T18:30:00Z",
  "updatedAt": "2026-05-25T18:30:00Z"
}
```

The non-`slug`/`createdAt`/`updatedAt` fields map 1:1 onto the `venue` block in the Match JSON — copy them straight in.

## Director profile shape

```json
{
  "slug": "jory-hanus",
  "name": "Jory Hanus",
  "uspsa": "A12345",
  "email": "jory@example.com",
  "createdAt": "2026-05-25T18:30:00Z",
  "updatedAt": "2026-05-25T18:30:00Z"
}
```

Same mapping rule: non-meta fields go into `matchDirector` block in the Match JSON.

## Slug rules

The filename slug should be:
- Lowercase
- Spaces → hyphens
- Strip apostrophes / punctuation
- Strip "the " prefix
- Trim trailing whitespace

Examples:
- `Brazos Valley Shooting Club` → `brazos-valley-shooting-club`
- `O'Reilly's Range` → `oreillys-range`
- `The Cedar Park Gun Club` → `cedar-park-gun-club`

Slug must be unique within the venues/ or directors/ folder. If a slug collision occurs, append `-2`, `-3`, etc.

## Reading profiles

On skill invocation (after the basic match name + date is captured), check both folders:

```python
import json
from pathlib import Path

venues_dir = Path.home() / "Documents/Match Day/profiles/venues"
directors_dir = Path.home() / "Documents/Match Day/profiles/directors"

venues = []
if venues_dir.is_dir():
    for p in sorted(venues_dir.glob("*.json")):
        venues.append(json.loads(p.read_text()))

directors = []
if directors_dir.is_dir():
    for p in sorted(directors_dir.glob("*.json")):
        directors.append(json.loads(p.read_text()))
```

Present these as named options in the AskUserQuestion Call 2. If neither folder exists or is empty, skip showing "saved" options and ask the user fresh.

## Writing profiles

After the match is saved, ASK the user before persisting:

> *"Save 'Brazos Valley Shooting Club' as a venue profile for next time? (Yes / No)"*

If yes:
1. Compute the slug
2. Check for an existing file at `~/Documents/Match Day/profiles/venues/<slug>.json`
3. If it exists, ask the user whether to **update** (overwrite) or **save as new** (append `-2`, etc.)
4. Write the JSON with `createdAt` (current time if new) + `updatedAt` (current time)
5. Confirm: *"Saved to ~/Documents/Match Day/profiles/venues/<slug>.json"*

Same flow for directors.

## Editing a saved profile

If the user picks a saved profile but then changes one of its fields during the session ("change my parking note to..."), and at the end asks to update the profile, **update** the existing file (re-write with new `updatedAt`).

## Deleting a profile

The skill doesn't expose a delete command. Direct the user to `rm ~/Documents/Match Day/profiles/venues/<slug>.json` if they ask.

## Backup / portability

Profiles are plain JSON files in a Finder-visible location. Users can back them up, copy them to a new machine, or share them with another MD by sending the .json file directly. No proprietary format, no lock-in.
