# PROPOSAL: ATO sub-accounts (Team)

**Status:** this is a design proposal. **Nothing is built.** MT has to confirm it before anyone writes a table or a route.
— Designer, 12 Nov 2026

## Why it clashes with the current rules
- DECISIONS-MASTER §6 says: *"Each school has one school-account login. No staff sub-accounts."*
- The database enforces that with the unique index `accounts_one_operator_per_school`.
- This proposal doesn't replace the one login. That login stays the **Owner**, the account that owns and pays.
- Members are **existing Go Around member accounts** linked to the ATO. They aren't extra school logins, so the unique index can stay. §6 still needs rewording if MT approves.

## What the ATO admin can do in the design
- **Invite** by email, one or many at once, choosing a role. Invites expire after 7 days. A pending invite holds a seat, and an expired one frees it.
- **Change a role** or **remove a member** from that member's sheet.
- **Filter** by All, Admins, Instructors, Students or Invites. Each member shows Active, Invited or Expired.
- **Watch seats**: "10 of 25 seats used". The invite sheet shows the seat count after sending.

## Roles (PROPOSAL)
| Can | Owner | Admin | Instructor | Student |
|---|---|---|---|---|
| Premium pilot tools | ✓ | ✓ | ✓ | ✓ |
| See the team list | ✓ | ✓ | ✓ | – |
| Invite and remove | ✓ | ✓ | – | – |
| Official replies | ✓ | ✓ | – | – |
| Page extras drafts | ✓ | ✓ | – | – |
| Billing and cancel | ✓ | – | – | – |

## Privacy rules (these don't change)
- The ATO **never** sees a member's reviews, votes, anonymous posts, email or billing.
- Reviews stay the member's own. A member's review of their own ATO is still bound by the review rules. The ATO can't hide or edit it.
- Removing someone ends only the access they got through the ATO. Their account, reviews and votes stay. If they pay for their own plan, it carries on.

## Proposed tables (sketch)
```sql
-- one row per member linked to an ATO
CREATE TABLE school_members (
  school_id   INTEGER NOT NULL REFERENCES schools(id),
  account_id  INTEGER NOT NULL REFERENCES accounts(id),
  role        TEXT NOT NULL CHECK (role IN ('admin','instructor','student')),
  status      TEXT NOT NULL DEFAULT 'active' CHECK (status IN ('active','removed')),
  invited_by  INTEGER REFERENCES accounts(id),
  created_at  TEXT NOT NULL DEFAULT (datetime('now')),
  removed_at  TEXT,
  PRIMARY KEY (school_id, account_id)
);
-- pending email invites; the token is stored hashed
CREATE TABLE school_invites (
  id          INTEGER PRIMARY KEY,
  school_id   INTEGER NOT NULL REFERENCES schools(id),
  email       TEXT NOT NULL,
  role        TEXT NOT NULL CHECK (role IN ('admin','instructor','student')),
  token_hash  TEXT NOT NULL UNIQUE,
  expires_at  TEXT NOT NULL,          -- created_at + 7 days
  accepted_at TEXT,
  created_at  TEXT NOT NULL DEFAULT (datetime('now'))
);
-- seats: a column on schools or entitlements, e.g. seats_included INTEGER DEFAULT 25
```
- Pro tools for members could come from a computed entitlement, such as "through school X while that school is paying". That fits "badges are computed, never stored".

## Open questions for MT
1. Do sub-accounts override §6? The proposal keeps the one-operator index.
2. How many seats does R3,999 include? The demo shows 25. Can an ATO buy more seats?
3. What does a member get? Every Premium pilot tool? What if they already pay for Pro or Founding: pause their plan, or just let it carry on? What happens when they're removed, or when the ATO's plan lapses?
4. Who writes official replies? I recommend Owner and Admin only.
5. Members must be 18+ (the sign-up rule). Confirm whether a student under 18 can be invited at all.

— Designer
