# PILOT-003

## Public Guest Identity Layer

You are implementing the third Pilot Launch feature for the INVEETAIRE platform.

Current status:

✅ Sprint 0 Complete
✅ Sprint 1 Complete
✅ Sprint 2 Complete
✅ Sprint 3 Complete
✅ PILOT-001 Invitation Engine
✅ PILOT-002 Guest Import Engine

Implement ONLY the Public Guest Identity Layer.

Do NOT implement WhatsApp Distribution.

Do NOT implement RSVP.

Do NOT implement Wish.

Do NOT implement Check-In.

Do NOT implement Attendance Dashboard.

---

# Goal

Every imported guest must receive a permanent public identity.

This identity will be reused by every future public feature.

The Guest Identity consists of:

* guest_token
* Personal Invitation URL
* QR Code

---

# Mandatory Reading

Read:

* AI.md
* WORKFLOW.md
* IMPLEMENTATION_ROADMAP.md
* PILOT-001 implementation memory
* PILOT-002 implementation memory

---

# Files Allowed

Create only:

app/modules/PublicInvitation/

```
PublicInvitationController.php

PublicInvitationService.php

PublicInvitationModel.php

routes.php
```

app/services/

```
QrCodeService.php
```

Create Views:

app/views/public/

```
identity.php
```

Modify only:

routes/web.php

No other files.

---

# Functional Scope

Implement:

## Guest Identity

Every Guest owns exactly one permanent:

* guest_token

The token must be reused forever.

Never regenerate the token once created.

---

## Personal Invitation URL

Generate a public URL:

https://your-domain/{workspace_slug}/i/{guest_token}

Example:

https://inveetaire.com/david-sarah/i/W6JP4QK83XAZR2MN

The URL must never expose:

* guest_id
* workspace_id
* invitation_id

---

## QR Code

Generate one QR Code for every guest.

QR payload contains only:

guest_token

Do NOT embed JSON.

Do NOT embed guest data.

Do NOT embed internal IDs.

The QR will later be used by:

* Check-In
* Attendance
* Printing

---

## Guest Resolution

Implement a resolver:

guest_token

↓

workspace

↓

guest

↓

invitation

↓

assigned wedding events

The resolver returns a structured object.

No HTML.

No rendering.

---

## Wedding Event Resolution

A Guest may belong to:

* Holy Matrimony
* Reception
* Both

The resolver must return every assigned wedding event.

Do NOT hardcode only one event.

Design for multiple event assignments.

Future events (Engagement, Tea Ceremony, After Party) must remain compatible.

---

# Service Responsibilities

Own:

* URL generation
* guest resolution
* QR generation coordination

No SQL.

No HTML.

---

# Model Responsibilities

Own:

* guest lookup
* workspace lookup
* invitation lookup
* wedding event lookup

Prepared PDO statements only.

Workspace isolation mandatory.

---

# QR Service

QrCodeService owns:

* QR generation
* payload formatting
* image output

No business logic.

No database access.

---

# Security

Verify:

* guest_token is the only public identifier.
* Every lookup is parameterized.
* No internal database IDs leak.
* QR contains only guest_token.
* Workspace isolation is enforced.
* Invalid tokens return 404.

---

# Constraints

Do NOT:

* implement RSVP
* implement Wish
* implement Guest Check-In
* implement WhatsApp
* implement Attendance Dashboard
* modify app/core/*
* modify Workspace module
* modify Invitation module
* modify Guest module database schema
* perform git operations

---

# Verification

Verify:

* URL generation.
* QR generation.
* Guest lookup.
* Invalid token handling.
* Multi-event resolution.
* PHP syntax.
* Workspace isolation.

---

# Acceptance Criteria

PASS only if:

* Public Invitation module created.
* QrCodeService created.
* Personal URL generated.
* QR generated.
* Guest resolved by guest_token.
* Multi-event resolution implemented.
* Internal IDs never exposed.
* 404 returned for invalid tokens.
* PHP syntax passes.
* Scope respected.

---

# Output

Provide:

1. Files created.
2. Files modified.
3. Guest identity workflow.
4. URL generation workflow.
5. QR generation workflow.
6. Guest resolution workflow.
7. Wedding event resolution workflow.
8. Security verification.
9. Acceptance checklist.
10. PHP syntax results.

Stop after implementation.

Wait for Human Approval.
