# Specification: 027-schedule-templates-overlays

## Status

| Field | Value |
|-------|-------|
| **Created** | 2026-01-04 |
| **Current Phase** | PLAN Complete |
| **Last Updated** | 2026-01-04 |

## Documents

| Document | Status | Notes |
|----------|--------|-------|
| product-requirements.md | completed | All sections complete, validation passed |
| solution-design.md | completed | All ADRs confirmed, full architecture documented |
| implementation-plan.md | completed | 217 tasks across 7 phases, reviewed and updated |

**Status values**: `pending` | `in_progress` | `completed` | `skipped`

## Decisions Log

| Date | Decision | Rationale |
|------|----------|-----------|
| 2026-01-04 | Started with PRD | User chose recommended workflow path |
| 2026-01-04 | UI Decisions for SDD | Templates: Toolbar dropdown, Overlays: Checkbox dropdown, Conflicts: Table list, Heat map: Background gradients |
| 2026-01-04 | Add full recurrence support | User chose to implement rather than defer |
| 2026-01-04 | Derive hourly sales data | Calculate from transaction timestamps for granularity parity with wait time |
| 2026-01-04 | 20 template limit per store | Confirmed by user (ADR-6) |
| 2026-01-04 | Mutually exclusive overlays | Confirmed by user (ADR-7) |
| 2026-01-04 | Detailed UI Implementation | Templates: Standalone button, Overlays: Flat checkbox list, Conflicts: Detailed rows, Recurrence: Toggle buttons |
| 2026-01-04 | PLAN Review Completed | Codex review identified 32 missing tasks; all added to implementation plan |
| 2026-01-04 | Phase Dependencies Fixed | Corrected T3→T4 dependency (API depends on Services) |
| 2026-01-04 | Overlay Policy Clarified | PRD/SDD conflict resolved - ADR-7 (mutually exclusive) confirmed for implementation |
| 2026-01-04 | Feature 10 Deferred | Event integration marked as future enhancement (Should Have) |
| 2026-01-04 | Cross-Cutting Tasks Added | Audit logging, Redis caching, localStorage persistence, atomic transactions |
| 2026-01-04 | Analytics Rules Added | Timezone conversion, operating hours filtering, data thresholds, event exclusion |
| 2026-01-04 | Edge Cases Added | Template overwrite, all inactive employees, soft delete, position inactive |
| 2026-01-04 | Task Breakdown Refined | Coarse tasks split into granular subtasks |

## Context

**Feature Request:** Comprehensive schedule template system with calendar overlays

### Core Features Requested:

1. **Schedule Templates**
   - Save a week's schedule as a named template with description
   - Load templates to replace current schedule
   - Copy open shifts from templates
   - Option to load entire template as open shifts
   - Handle missing employees (from terminated staff) as open shifts
   - Overwrite and save new templates
   - Integration with event system for event-based scheduling (e.g., "busy time template")

2. **Availability Overlays**
   - Show employee availability on calendar
   - Show requested time off
   - Show approved time off (blocking)
   - When importing templates, detect conflicts with availability/time-off and convert to open shifts with notification

3. **Repeat Shifts**
   - Support for recurring shifts (e.g., manager works specific days every week)
   - UI exists but need to verify calendar and backend support

4. **Analytics Overlays**
   - Overlay wait time report data on calendar
   - Overlay sales report data on calendar
   - Visual indicator of expected business levels during scheduling

---
*This file is managed by the specification-management skill.*
