# TASK IMPLEMENTATION — WS-002

## Workspace Setup Checklist

You are implementing exactly one Sprint 3 task for the INVEETAIRE project.

Current completed tasks:

* Sprint 0 ✅
* Sprint 1 ✅
* Sprint 2 ✅
* Database Foundation ✅
* S3-002 Security Hardening ✅
* S3-003 WorkspaceMiddleware ✅
* WS-001A Workspace Foundation ✅
* WS-001B Workspace Provisioning ✅

Implement ONLY the Workspace Setup Checklist.

Do not begin WS-003.

---

# Mandatory Reading

Read:

* AI.md v1.1
* SPRINT3_PLANNING.md
* SPRINT3_EXECUTION_GUIDE.md
* WS-001 implementation memories

If documentation conflicts exist:

STOP.

Report.

Wait.

---

# Objective

Implement the Couple Dashboard setup checklist.

Business logic belongs inside WorkspaceService.

Database queries belong inside WorkspaceModel.

Views render data only.

---

# Files Allowed

## New Files

```text
app/views/components/checklist_widget.php
```

## Modified Files

```text
app/modules/Workspace/WorkspaceService.php

app/modules/Workspace/WorkspaceModel.php
```

No other files may be modified.

---

# Checklist Steps

Implement exactly seven checklist steps:

1. Workspace Provisioned

   * Always completed.

2. Configure Invitation

   * Complete when invitation status is not "draft".

3. Select Theme

   * Complete when theme_version_id is assigned.

4. Add First Guest

   * Complete when guest count > 0.

5. Configure Printer

   * Complete when printer configuration differs from its default state.

6. Create First Wedding Event

   * Complete when at least one wedding event exists.

7. Ready To Send

   * Automatically completed only when all required prerequisite steps are satisfied.

---

# Service Responsibilities

WorkspaceService shall:

* Evaluate checklist status.
* Return a structured checklist object/array.
* Calculate completion progress.
* Determine whether "Ready To Send" is unlocked.

No SQL.

No presentation.

No HTML.

No session rendering.

---

# Model Responsibilities

WorkspaceModel shall:

Execute only parameterized PDO queries to retrieve:

* invitation status
* theme version
* guest count
* printer configuration state
* wedding event count

No business logic.

No transactions.

No session access.

No presentation.

---

# View Responsibilities

Create:

app/views/components/checklist_widget.php

The component shall:

* Render all seven steps.
* Show completed / pending state.
* Display progress percentage.
* Use escape_html() for every dynamic value.
* Never access PDO.
* Never query the database.
* Never access sessions directly.

The component must be reusable.

---

# Security

Verify:

* Parameterized PDO queries only.
* No SQL concatenation.
* No tenant leakage.
* Every workspace query is filtered using workspace_id.
* No HTML injection.

---

# Constraints

Do NOT:

* modify WorkspaceMiddleware
* modify Controller
* modify Validator
* modify routes
* modify app/core/*
* modify Router
* modify BaseController
* modify MiddlewarePipeline
* modify database schema
* modify authentication
* perform git operations

---

# Verification

Before finishing:

* php -l every modified PHP file.
* Verify all seven checklist rules.
* Verify progress calculation.
* Verify Ready To Send logic.
* Verify view contains no SQL.
* Verify service contains no HTML.
* Verify model contains no business logic.
* Verify workspace isolation on every query.

---

# Acceptance Criteria

PASS only if:

* Checklist component created.
* Seven checklist steps implemented.
* WorkspaceService evaluates checklist.
* WorkspaceModel performs all data retrieval.
* Progress percentage calculated.
* Ready To Send gate implemented.
* View is presentation-only.
* Every query uses workspace_id.
* PHP syntax passes.
* Scope respected.

---

# Output

Provide:

1. Files created.
2. Files modified.
3. Checklist evaluation workflow.
4. Progress calculation logic.
5. Ready To Send logic.
6. Security verification.
7. Acceptance checklist.
8. PHP syntax results.
9. Confirmation that WS-003 was NOT started.

Stop after the implementation report.

Wait for Human Approval.
