# Phase Manifest

# Registry of implementation phases for TorbatYar.
# Status: planned | in_progress | complete | deferred
# Agents must keep this file aligned with docs/progress.md and docs/roadmap.md.

schema_version: 1
updated: "2026-07-26"
# AF-Discovery complete: Enterprise Phase Discovery mandate (ADR-019).
# AF-Enterprise complete: Enterprise Development Framework upgrade (ADR-018).
# Hospitality Phase 12.1 complete; 12.2 QR Menu & QR Ordering next for Hospitality track.
# Experience 11.2 Component Library complete; next experience-11.3 was completed — next experience-11.4 Template System.
# Experience 11.3 Theme & Layout complete; next experience-11.4 Template System.
# Delivery Platform registration complete; Phase 10.1 Driver Management complete; next delivery-10.2.
# Loyalty Phase 7.1 complete; 7.2 Point Engine next for Loyalty track.

phases:
  - id: core-1
    name: Core Platform
    area: Platform
    status: complete
    dependencies: []
    required_documents:
      - docs/architecture/architecture.md
      - docs/development/project-principles.md
    required_services:
      - core-platform

  - id: identity-2
    name: Identity & Access + SSO
    area: Platform
    status: complete
    dependencies:
      - core-1
    required_documents:
      - docs/architecture/identity-architecture.md
      - docs/architecture/adr/ADR-004.md
    required_services:
      - identity-access
      - core-platform

  - id: otp-tenant-3
    name: OTP Login + Tenant Management
    area: Platform
    status: complete
    dependencies:
      - identity-2
    required_documents:
      - docs/architecture/adr/ADR-005.md
      - docs/architecture/multi-tenant-architecture.md
    required_services:
      - core-platform

  - id: onboarding-4
    name: Tenant Onboarding & Workspace Activation
    area: Platform
    status: complete
    dependencies:
      - otp-tenant-3
    required_documents:
      - docs/architecture/multi-tenant-architecture.md
      - docs/architecture/adr/ADR-008.md
      - docs/architecture/adr/ADR-009.md
    required_services:
      - core-platform
      - identity-access

  - id: docs-architecture-D
    name: Documentation Architecture Consolidation
    area: Platform
    status: complete
    dependencies:
      - onboarding-4
    required_documents:
      - docs/README.md
      - docs/architecture/adr/README.md
    required_services: []

  - id: ai-framework
    name: AI Development Framework
    area: Platform
    status: complete
    dependencies:
      - docs-architecture-D
    required_documents:
      - docs/ai-framework/README.md
      - docs/ai-framework/master-prompt.md
      - docs/ai-framework/development-loop.md
      - docs/ai-framework/quality-gates.md
      - docs/architecture/adr/ADR-013.md
    required_services: []

  - id: ai-framework-enterprise
    name: Enterprise Development Framework Upgrade
    area: Platform
    description: Docs-only upgrade of the AI Development Framework into an Enterprise Development Framework — Definition of Done, mandatory phase artifacts, enterprise completeness, boundary rules, expanded gates/loop/templates. No business feature code. Extends ADR-013 via ADR-018. Does not modify completed business phases or implementations.
    status: complete
    dependencies:
      - ai-framework
    required_previous_phase: ai-framework
    required_documents:
      - docs/ai-framework/README.md
      - docs/ai-framework/definition-of-done.md
      - docs/ai-framework/mandatory-phase-artifacts.md
      - docs/ai-framework/enterprise-completeness.md
      - docs/ai-framework/boundary-rules.md
      - docs/ai-framework/master-prompt.md
      - docs/ai-framework/development-loop.md
      - docs/ai-framework/quality-gates.md
      - docs/ai-framework/phase-template.md
      - docs/ai-framework/phase-handover.md
      - docs/architecture/adr/ADR-018.md
      - docs/phase-handover/phase-af-enterprise.md
    required_services: []
    completion_criteria:
      - DoD, mandatory artifacts, enterprise completeness, and boundary rules documents published
      - Master prompt, development loop, quality gates, templates, prompt/cursor rules updated
      - ADR-018 accepted; ADR index and glossary updated
      - Framework handover complete; no business code changes
      - Backward-compatible path docs/ai-framework/ retained
      - Quality gates for documentation/architecture/manifest validation passed

  - id: ai-framework-discovery
    name: Enterprise Phase Discovery Mandate
    area: Platform
    description: Docs-only framework enhancement — mandatory Enterprise Phase Discovery before every phase implementation. Agents must inventory roadmap, architecture, boundaries, prior handover, codebase, APIs, domain, events, permissions, aggregates, tests, and docs; derive missing current-phase production capabilities; never assume CRUD; never pull future phases or violate boundaries. ADR-019 extends ADR-018. No business feature code.
    status: complete
    dependencies:
      - ai-framework-enterprise
    required_previous_phase: ai-framework-enterprise
    required_documents:
      - docs/ai-framework/enterprise-phase-discovery.md
      - docs/ai-framework/README.md
      - docs/ai-framework/master-prompt.md
      - docs/ai-framework/development-loop.md
      - docs/ai-framework/quality-gates.md
      - docs/ai-framework/phase-template.md
      - docs/ai-framework/phase-handover.md
      - docs/ai-framework/definition-of-done.md
      - docs/architecture/adr/ADR-019.md
      - docs/phase-handover/phase-af-discovery.md
    required_services: []
    completion_criteria:
      - enterprise-phase-discovery.md published with inputs, procedure, checklist, Discovery Record
      - Loop stage 1 is Discovery; quality gates include Discovery gate
      - Phase template/handover/prompt/cursor/DoD/completeness updated
      - ADR-019 accepted; glossary/progress/manifests updated
      - Framework handover complete; no business code changes
      - Quality gates for documentation/architecture/manifest validation passed

  # --- Accounting ---
  - id: accounting-5.1
    name: Accounting Foundation
    area: Accounting
    status: complete
    dependencies:
      - onboarding-4
    required_documents:
      - docs/phases/Accounting/README.md
      - docs/architecture/adr/ADR-010.md
    required_services:
      - accounting

  - id: accounting-5.2
    name: Double-Entry Posting Engine
    area: Accounting
    status: complete
    dependencies:
      - accounting-5.1
    required_documents:
      - docs/phases/Accounting/phase-5.2-double-entry-posting-engine.md
      - docs/architecture/adr/ADR-010.md
    required_services:
      - accounting

  - id: accounting-5.3
    name: General Ledger & Fiscal Management
    area: Accounting
    status: complete
    dependencies:
      - accounting-5.2
    required_documents:
      - docs/phases/Accounting/phase-5.3-general-ledger-fiscal-management.md
    required_services:
      - accounting

  - id: accounting-5.4
    name: Treasury Management
    area: Accounting
    status: complete
    dependencies:
      - accounting-5.3
    required_documents:
      - docs/phases/Accounting/phase-5.4-treasury-management.md
    required_services:
      - accounting

  - id: accounting-5.5
    name: Accounts Receivable & Payable
    area: Accounting
    status: complete
    dependencies:
      - accounting-5.4
    required_documents:
      - docs/phases/Accounting/phase-5.5-accounts-receivable-payable.md
    required_services:
      - accounting

  - id: accounting-5.6
    name: Sales Accounting Integration
    area: Accounting
    status: complete
    dependencies:
      - accounting-5.5
    required_documents:
      - docs/phases/Accounting/phase-5.6-sales-accounting-integration.md
    required_services:
      - accounting

  - id: accounting-5.7
    name: Purchase & Inventory Accounting
    area: Accounting
    status: complete
    dependencies:
      - accounting-5.6
    required_documents:
      - docs/phases/Accounting/phase-5.7-purchase-inventory-accounting-integration.md
    required_services:
      - accounting

  - id: accounting-5.8
    name: Fixed Assets
    area: Accounting
    status: complete
    dependencies:
      - accounting-5.7
    required_documents:
      - docs/phases/Accounting/phase-5.8-fixed-assets-management.md
    required_services:
      - accounting

  - id: accounting-5.9
    name: HCM / Payroll Accounting
    area: Accounting
    status: complete
    dependencies:
      - accounting-5.8
    required_documents:
      - docs/phases/Accounting/phase-5.9-hcm-payroll-accounting.md
    required_services:
      - accounting

  - id: accounting-5.10
    name: Financial Reporting & BI
    area: Accounting
    status: complete
    dependencies:
      - accounting-5.9
    required_documents:
      - docs/phases/Accounting/phase-5.10-financial-reporting-business-intelligence.md
    required_services:
      - accounting

  - id: accounting-5.11
    name: Compliance, Audit & Governance
    area: Accounting
    status: complete
    dependencies:
      - accounting-5.10
    required_documents:
      - docs/phases/Accounting/phase-5.11-enterprise-compliance-audit-governance.md
    required_services:
      - accounting

  - id: accounting-5.12
    name: Accounting AI Assistants
    area: Accounting
    status: planned
    dependencies:
      - accounting-5.11
      - ai-framework
    required_documents:
      - docs/architecture/ai-architecture.md
      - docs/phases/Accounting/README.md
    required_services:
      - accounting

  # --- CRM ---
  - id: crm-6.0
    name: CRM Service Foundation
    area: CRM
    status: complete
    dependencies:
      - onboarding-4
    required_documents:
      - docs/crm-phase-6-0.md
      - docs/phases/CRM/README.md
    required_services:
      - crm

  - id: crm-6.1
    name: CRM Core Business Entities
    area: CRM
    status: complete
    dependencies:
      - crm-6.0
    required_documents:
      - docs/crm-phase-6-1.md
    required_services:
      - crm

  - id: crm-6.2
    name: CRM Sales Process Engine
    area: CRM
    status: complete
    dependencies:
      - crm-6.1
    required_documents:
      - docs/crm-phase-6-2.md
    required_services:
      - crm

  - id: crm-6.3
    name: CRM Sales Collaboration
    area: CRM
    status: complete
    dependencies:
      - crm-6.2
    required_documents:
      - docs/crm-phase-6-3.md
    required_services:
      - crm

  # --- Loyalty ---
  - id: loyalty-7.0
    name: Loyalty Service Foundation
    area: Loyalty
    status: complete
    dependencies:
      - onboarding-4
    required_documents:
      - docs/loyalty-phase-7-0.md
      - docs/architecture/adr/ADR-011.md
      - docs/phases/Loyalty/README.md
    required_services:
      - loyalty

  - id: loyalty-7.1
    name: Membership Engine
    area: Loyalty
    status: complete
    dependencies:
      - loyalty-7.0
      - ai-framework
    required_documents:
      - docs/loyalty-phase-7-1.md
      - docs/phase-handover/phase-7-1.md
      - docs/phases/Loyalty/README.md
      - docs/architecture/adr/ADR-011.md
    required_services:
      - loyalty

  - id: loyalty-7.2
    name: Point Engine
    area: Loyalty
    status: planned
    dependencies:
      - loyalty-7.1
    required_documents:
      - docs/phases/Loyalty/README.md
      - docs/ai-framework/phase-template.md
    required_services:
      - loyalty

  # --- SMS / Communication ---
  - id: communication-8
    name: Enterprise Communication Platform (SMS-first)
    area: SMS
    status: complete
    dependencies:
      - onboarding-4
    required_documents:
      - docs/communication-phase-8.md
      - docs/architecture/adr/ADR-012.md
    required_services:
      - communication

  - id: sms-panel-future
    name: Legacy SMS Panel Scaffold Alignment
    area: SMS
    status: deferred
    dependencies:
      - communication-8
    required_documents:
      - docs/module-registry.md
    required_services:
      - sms_panel
    notes: Prefer Communication service (ADR-012); sms_panel scaffold remains historical/planned alignment only.

  # --- Sports Center (Phase 9.0–9.10) ---
  - id: sports-center-9.0
    name: Sports Center Foundation
    area: Sports Center
    description: Independent sports_center service scaffold, sports_center_db, health/capabilities, permissions sports_center.*, publish-only events, tenant isolation, audit shell.
    status: complete
    dependencies:
      - onboarding-4
      - ai-framework
    required_previous_phase: ai-framework
    required_documents:
      - docs/sports-center-roadmap.md
      - docs/phases/SportsCenter/README.md
      - docs/architecture/adr/ADR-014.md
      - docs/sports-center-phase-9-0.md
      - docs/phase-handover/phase-9-0.md
      - docs/ai-framework/service-template.md
      - docs/ai-framework/phase-template.md
    required_services:
      - sports_center
    completion_criteria:
      - Service scaffold under backend/services/sports_center with API → Service → Repository → Model layering
      - Alembic initial migration for foundation tables only as scoped
      - Health endpoint green; permission tree sports_center.* documented
      - Tenant isolation + architecture + docs tests green
      - Module registry, manifests, progress, handover updated
      - Quality gates passed; no business engines beyond foundation

  - id: sports-center-9.1
    name: Membership Catalog
    area: Sports Center
    description: Membership types, packages, plans, pricing models, age groups, sport categories, membership rules, renewal/freezing/expiration policies, validation, events, APIs.
    status: complete
    dependencies:
      - sports-center-9.0
    required_previous_phase: sports-center-9.0
    required_documents:
      - docs/sports-center-roadmap.md
      - docs/phases/SportsCenter/README.md
      - docs/architecture/adr/ADR-014.md
      - docs/sports-center-phase-9-1.md
      - docs/phase-handover/phase-9-1.md
      - docs/ai-framework/module-template.md
    required_services:
      - sports_center
    completion_criteria:
      - Membership catalog aggregates implemented with tenant isolation
      - APIs, validators, permissions, events, tests, docs, handover complete
      - No member enrollment / coach / attendance / booking engines

  - id: sports-center-9.2
    name: Member Management
    area: Sports Center
    description: Members, family members, medical information, emergency contacts, membership assignment, cards/QR/digital membership, waivers, documents, attachments, status management.
    status: complete
    dependencies:
      - sports-center-9.1
    required_previous_phase: sports-center-9.1
    required_documents:
      - docs/sports-center-roadmap.md
      - docs/phases/SportsCenter/README.md
      - docs/phase-handover/phase-9-1.md
      - docs/sports-center-phase-9-2.md
      - docs/phase-handover/phase-9-2.md
      - docs/ai-framework/module-template.md
    required_services:
      - sports_center
    completion_criteria:
      - Member management APIs + validators + tests green
      - Consumes Membership Catalog from 9.1; does not recreate catalog tables
      - No coach/attendance/booking engines yet

  - id: sports-center-9.3
    name: Coach & Staff Management
    area: Sports Center
    description: Coaches, trainers, nutritionists, medical staff, reception, managers, working hours, certificates, skills, payroll refs, availability, permissions.
    status: planned
    dependencies:
      - sports-center-9.2
    required_previous_phase: sports-center-9.2
    required_documents:
      - docs/sports-center-roadmap.md
      - docs/phases/SportsCenter/README.md
      - docs/ai-framework/module-template.md
    required_services:
      - sports_center
    completion_criteria:
      - Coach and staff modules complete with APIs, permissions, events, tests, docs
      - No attendance devices or booking engine yet

  - id: sports-center-9.4
    name: Scheduling & Booking
    area: Sports Center
    description: Sports classes, sessions, timetables, reservations, capacity, waiting lists, recurring sessions, resource allocation, facilities, equipment reservation, calendar.
    status: planned
    dependencies:
      - sports-center-9.3
    required_previous_phase: sports-center-9.3
    required_documents:
      - docs/sports-center-roadmap.md
      - docs/phases/SportsCenter/README.md
    required_services:
      - sports_center
    completion_criteria:
      - Booking and scheduling APIs and rules green
      - Tests include conflict/tenant isolation; docs/handover updated

  - id: sports-center-9.5
    name: Attendance & Access Control
    area: Sports Center
    description: Attendance, QR/RFID/barcode/face-ready check-in, manual attendance, entry/exit gates, late arrival, absence, attendance history.
    status: planned
    dependencies:
      - sports-center-9.4
    required_previous_phase: sports-center-9.4
    required_documents:
      - docs/sports-center-roadmap.md
      - docs/phases/SportsCenter/README.md
    required_services:
      - sports_center
    completion_criteria:
      - Attendance and access control complete with isolation/security tests
      - Vendor adapters remain outside business services

  - id: sports-center-9.6
    name: Training Management
    area: Sports Center
    description: Training programs, exercises, workout plans, goals, measurements, progress tracking, nutrition plans, body composition, assessments, performance records.
    status: planned
    dependencies:
      - sports-center-9.5
    required_previous_phase: sports-center-9.5
    required_documents:
      - docs/sports-center-roadmap.md
      - docs/phases/SportsCenter/README.md
    required_services:
      - sports_center
    completion_criteria:
      - Training/workout modules complete with APIs, events, tests, docs
      - No competitions module yet

  - id: sports-center-9.7
    name: Competition & Event Management
    area: Sports Center
    description: Competitions, tournaments, matches, teams, groups, registrations, rankings, results, medals, certificates, judges, schedules.
    status: planned
    dependencies:
      - sports-center-9.6
    required_previous_phase: sports-center-9.6
    required_documents:
      - docs/sports-center-roadmap.md
      - docs/phases/SportsCenter/README.md
    required_services:
      - sports_center
    completion_criteria:
      - Competitions and events modules complete; no payment posting ownership
      - Tests, docs, handover complete

  - id: sports-center-9.8
    name: Financial Integration
    area: Sports Center
    description: Integrate Accounting, CRM, Loyalty, Communication, payments, invoices, subscriptions, discounts, refunds, installments via API/Events only — no business logic duplication.
    status: planned
    dependencies:
      - sports-center-9.7
      - accounting-5.11
      - crm-6.3
      - loyalty-7.0
      - communication-8
    required_previous_phase: sports-center-9.7
    required_documents:
      - docs/sports-center-roadmap.md
      - docs/architecture/adr/ADR-010.md
      - docs/architecture/adr/ADR-011.md
      - docs/architecture/adr/ADR-012.md
      - docs/architecture/adr/ADR-014.md
    required_services:
      - sports_center
      - accounting
      - crm
      - loyalty
      - communication
    completion_criteria:
      - Integrations via API/events only; no journal creation inside Sports Center
      - Tests prove no cross-DB access; docs/contracts updated

  - id: sports-center-9.9
    name: AI & Analytics
    area: Sports Center
    description: Integrate Enterprise AI Platform for recommendations, attendance/retention/churn prediction, workout suggestions, capacity forecasting, dashboards and KPIs — AI optional.
    status: planned
    dependencies:
      - sports-center-9.8
      - ai-framework
    required_previous_phase: sports-center-9.8
    required_documents:
      - docs/sports-center-roadmap.md
      - docs/architecture/ai-architecture.md
      - docs/phases/AI/README.md
    required_services:
      - sports_center
    completion_criteria:
      - Analytics/AI surfaces documented/implemented per scope
      - Core flows work when AI is off
      - Tests and docs complete

  - id: sports-center-9.10
    name: Enterprise Validation
    area: Sports Center
    description: Full AI Framework validation — architecture, security, performance, docs, integration, tenant isolation, migration, API compatibility, dependency checks, self-heal until green.
    status: planned
    dependencies:
      - sports-center-9.9
    required_previous_phase: sports-center-9.9
    required_documents:
      - docs/sports-center-roadmap.md
      - docs/phases/SportsCenter/README.md
      - docs/ai-framework/quality-gates.md
      - docs/ai-framework/phase-handover.md
      - docs/deployment/production.md
    required_services:
      - sports_center
    completion_criteria:
      - All Sports Center quality gates passed
      - Production readiness notes complete
      - Module registry version/phase updated; progress marks 9.10 complete
      - No undocumented public API/event/permission


  # --- Delivery & Fleet Platform (Phase 10.0–10.10) ---
  - id: delivery-reg
    name: Delivery & Fleet Platform Registration
    area: Delivery
    description: Documentation-only registration of independent delivery service, delivery_db, phases 10.0–10.10, ADR-015, module/glossary/boundary updates. No business code.
    status: complete
    dependencies:
      - onboarding-4
      - ai-framework
    required_previous_phase: ai-framework
    required_documents:
      - docs/delivery-roadmap.md
      - docs/phases/Delivery/README.md
      - docs/architecture/adr/ADR-015.md
      - docs/phase-handover/phase-dp-reg.md
      - docs/ai-framework/service-template.md
      - docs/ai-framework/phase-template.md
    required_services:
      - delivery
    completion_criteria:
      - Service registered in service-manifest with delivery_db and delivery.* permissions
      - Phases 10.0–10.10 registered in phase-manifest
      - Module registry, glossary, module-boundaries, ADR-015 updated
      - Progress and next-steps updated; handover complete
      - No business code, models, APIs, or migrations in this phase
      - Quality gates for documentation/architecture/manifest validation passed

  - id: delivery-10.0
    name: Delivery Platform Foundation
    area: Delivery
    description: Independent delivery service scaffold, delivery_db, health/capabilities/metrics, permissions delivery.*, publish-only event shells, tenant isolation, audit/config shells, provider/routing-engine contracts only.
    status: complete
    dependencies:
      - delivery-reg
    required_previous_phase: delivery-reg
    required_documents:
      - docs/delivery-roadmap.md
      - docs/phases/Delivery/README.md
      - docs/architecture/adr/ADR-015.md
      - docs/phase-handover/phase-dp-reg.md
      - docs/delivery-phase-10-0.md
      - docs/phase-handover/phase-10-0.md
      - docs/ai-framework/service-template.md
      - docs/ai-framework/phase-template.md
    required_services:
      - delivery
    completion_criteria:
      - Service scaffold under backend/services/delivery with API → Service → Repository → Model layering
      - Alembic initial migration for foundation tables only as scoped
      - Health, capabilities, metrics endpoints; permission tree delivery.* documented
      - Tenant isolation + architecture + docs tests green
      - No dispatch/routing/tracking engines beyond foundation shells
      - Quality gates passed; handover complete

  - id: delivery-10.1
    name: Driver Management
    area: Delivery
    description: Drivers, profiles, credential refs, status lifecycle, permissions, events, APIs.
    status: complete
    dependencies:
      - delivery-10.0
    required_previous_phase: delivery-10.0
    required_documents:
      - docs/delivery-roadmap.md
      - docs/phases/Delivery/README.md
      - docs/architecture/adr/ADR-015.md
      - docs/ai-framework/module-template.md
      - docs/delivery-phase-10-1.md
      - docs/phase-handover/phase-10-1.md
    required_services:
      - delivery
    completion_criteria:
      - Driver management APIs + validators + tests green
      - Lifecycle, credentials/documents, outbox, list filter/sort/search
      - No fleet/dispatch/routing engines yet
      - Quality gates passed; handover complete

  - id: delivery-10.2
    name: Fleet & Vehicle Types
    area: Delivery
    description: Fleets, vehicle types catalog, vehicles, assignments shells, permissions, events, APIs.
    status: planned
    dependencies:
      - delivery-10.1
    required_previous_phase: delivery-10.1
    required_documents:
      - docs/delivery-roadmap.md
      - docs/phases/Delivery/README.md
    required_services:
      - delivery
    completion_criteria:
      - Fleet and vehicle modules complete with tenant isolation tests
      - No dispatch engine yet

  - id: delivery-10.3
    name: Availability, Shifts & Working Zones
    area: Delivery
    description: Driver availability, shift management, working zones, readiness rules.
    status: planned
    dependencies:
      - delivery-10.2
    required_previous_phase: delivery-10.2
    required_documents:
      - docs/delivery-roadmap.md
      - docs/phases/Delivery/README.md
    required_services:
      - delivery
    completion_criteria:
      - Availability/shift/zone APIs + tests green
      - No dispatch/routing engines yet

  - id: delivery-10.4
    name: Pricing, Capabilities & Bundles
    area: Delivery
    description: Delivery pricing shells, capability flags, capability bundles.
    status: planned
    dependencies:
      - delivery-10.3
    required_previous_phase: delivery-10.3
    required_documents:
      - docs/delivery-roadmap.md
      - docs/phases/Delivery/README.md
    required_services:
      - delivery
    completion_criteria:
      - Pricing/capabilities/bundles APIs + validators + tests green
      - No settlement posting ownership

  - id: delivery-10.5
    name: Dispatch Engine
    area: Delivery
    description: Dispatch engine, job assignment, dispatcher workflows (API), multi-vertical job refs.
    status: planned
    dependencies:
      - delivery-10.4
    required_previous_phase: delivery-10.4
    required_documents:
      - docs/delivery-roadmap.md
      - docs/phases/Delivery/README.md
    required_services:
      - delivery
    completion_criteria:
      - Dispatch APIs + isolation/security tests green
      - Verticals interact via API/events only
      - No deep routing optimization yet (10.6)

  - id: delivery-10.6
    name: Routing & Optimization
    area: Delivery
    description: Routing plans, multi pickup, multi drop, optimization strategies, future routing engine adapters.
    status: planned
    dependencies:
      - delivery-10.5
    required_previous_phase: delivery-10.5
    required_documents:
      - docs/delivery-roadmap.md
      - docs/phases/Delivery/README.md
    required_services:
      - delivery
    completion_criteria:
      - Routing/optimization modules complete; external engines via adapters
      - Tests and docs complete

  - id: delivery-10.7
    name: Tracking & Proof of Delivery
    area: Delivery
    description: Live tracking, journey timeline, proof of delivery, customer tracking APIs.
    status: planned
    dependencies:
      - delivery-10.6
    required_previous_phase: delivery-10.6
    required_documents:
      - docs/delivery-roadmap.md
      - docs/phases/Delivery/README.md
    required_services:
      - delivery
    completion_criteria:
      - Tracking and POD APIs + tenant isolation tests green
      - Distinct from Communication message delivery tracking

  - id: delivery-10.8
    name: Settlement
    area: Delivery
    description: Driver/merchant settlement intents; post to Accounting via API/Events only — no journal ownership.
    status: planned
    dependencies:
      - delivery-10.7
      - accounting-5.11
    required_previous_phase: delivery-10.7
    required_documents:
      - docs/delivery-roadmap.md
      - docs/architecture/adr/ADR-010.md
      - docs/architecture/adr/ADR-015.md
    required_services:
      - delivery
      - accounting
    completion_criteria:
      - Settlement via Accounting APIs/events only; no cross-DB access
      - Tests prove no journal creation inside Delivery

  - id: delivery-10.9
    name: Merchant Connector & App Surfaces
    area: Delivery
    description: Merchant connector for verticals, notifications via Communication, Driver App and Dispatcher Panel API contracts, customer tracking polish.
    status: planned
    dependencies:
      - delivery-10.8
      - communication-8
    required_previous_phase: delivery-10.8
    required_documents:
      - docs/delivery-roadmap.md
      - docs/architecture/adr/ADR-012.md
      - docs/architecture/adr/ADR-015.md
    required_services:
      - delivery
      - communication
    completion_criteria:
      - Connector + notification client + app API contracts documented/tested
      - No SMS provider ownership; UI remains in frontend

  - id: delivery-10.10
    name: Analytics, AI Ready & Enterprise Validation
    area: Delivery
    description: Fleet analytics shells, AI-ready optional hooks, full AI Framework validation — architecture, security, performance, docs, integration, tenant isolation, migration, API compatibility, self-heal until green.
    status: planned
    dependencies:
      - delivery-10.9
      - ai-framework
    required_previous_phase: delivery-10.9
    required_documents:
      - docs/delivery-roadmap.md
      - docs/phases/Delivery/README.md
      - docs/ai-framework/quality-gates.md
      - docs/ai-framework/phase-handover.md
      - docs/architecture/ai-architecture.md
    required_services:
      - delivery
    completion_criteria:
      - All Delivery quality gates passed
      - Core flows work when AI is off
      - Module registry version/phase updated; progress marks 10.10 complete
      - No undocumented public API/event/permission

  # --- Experience Platform / Torbat Pages (Phase 11.0–11.10) ---
  - id: experience-reg
    name: Experience Platform Registration
    area: Experience
    description: Documentation-only registration of independent experience service, experience_db, phases 11.0–11.10, ADR-016, module/glossary/boundary updates. No business code. Prefer experience over historical website_builder scaffold.
    status: complete
    dependencies:
      - onboarding-4
      - ai-framework
    required_previous_phase: ai-framework
    required_documents:
      - docs/experience-roadmap.md
      - docs/phases/Experience/README.md
      - docs/architecture/adr/ADR-016.md
      - docs/experience-phase-xp-reg.md
      - docs/phase-handover/phase-xp-reg.md
      - docs/ai-framework/service-template.md
      - docs/ai-framework/phase-template.md
    required_services:
      - experience
    completion_criteria:
      - Service registered in service-manifest with experience_db and experience.* permissions
      - Phases 11.0–11.10 registered in phase-manifest
      - Module registry, glossary, module-boundaries, ADR-016 updated
      - Progress and next-steps updated; handover complete
      - No business code, models, APIs, or migrations in this phase
      - Quality gates for documentation/architecture/manifest validation passed

  - id: experience-11.0
    name: Experience Platform Foundation
    area: Experience
    description: Independent experience service scaffold, experience_db, health/capabilities/metrics, permissions experience.*, publish-only event shells, tenant isolation, audit/config shells, provider contracts only.
    status: complete
    dependencies:
      - experience-reg
    required_previous_phase: experience-reg
    required_documents:
      - docs/experience-roadmap.md
      - docs/phases/Experience/README.md
      - docs/architecture/adr/ADR-016.md
      - docs/phase-handover/phase-xp-reg.md
      - docs/experience-phase-11-0.md
      - docs/phase-handover/phase-11-0.md
      - docs/ai-framework/service-template.md
      - docs/ai-framework/phase-template.md
    required_services:
      - experience
    completion_criteria:
      - Service scaffold under backend/services/experience with API → Service → Repository → Model layering
      - Alembic initial migration for foundation tables only as scoped
      - Health, capabilities, metrics endpoints; permission tree experience.* documented
      - Tenant isolation + architecture + docs tests green
      - No page/theme/template engines beyond foundation shells
      - Quality gates passed; handover complete

  - id: experience-11.1
    name: Sites & Page Resources
    area: Experience
    description: Sites, pages as resources, page types (landing, mini site, menu, bio, profile, event, campaign, portfolio, blog, QR, SEO, media, knowledge, …), lifecycle, permissions, events, APIs.
    status: complete
    dependencies:
      - experience-11.0
    required_previous_phase: experience-11.0
    required_documents:
      - docs/experience-roadmap.md
      - docs/phases/Experience/README.md
      - docs/architecture/adr/ADR-016.md
      - docs/experience-phase-11-1.md
      - docs/phase-handover/phase-11-1.md
      - docs/ai-framework/module-template.md
    required_services:
      - experience
    completion_criteria:
      - Site and page resource APIs + validators + tests green
      - No component versioning / theme / template engines yet

  - id: experience-11.2
    name: Component Library & Versioning
    area: Experience
    description: Versioned components, component versions, composition shells, permissions, events, APIs.
    status: complete
    dependencies:
      - experience-11.1
    required_previous_phase: experience-11.1
    required_documents:
      - docs/experience-roadmap.md
      - docs/phases/Experience/README.md
      - docs/experience-phase-11-2.md
      - docs/phase-handover/phase-11-2.md
    required_services:
      - experience
    completion_criteria:
      - Component library with immutable versions; tenant isolation tests green
      - No theme/layout engine yet

  - id: experience-11.3
    name: Theme & Layout Engine
    area: Experience
    description: Replaceable themes, dynamic layouts, directionality-ready shells.
    status: complete
    dependencies:
      - experience-11.2
    required_previous_phase: experience-11.2
    required_documents:
      - docs/experience-roadmap.md
      - docs/phases/Experience/README.md
      - docs/architecture/adr/ADR-008.md
      - docs/experience-phase-11-3.md
      - docs/phase-handover/phase-11-3.md
    required_services:
      - experience
    completion_criteria:
      - Theme and layout APIs + tests green
      - No template catalog engine yet

  - id: experience-11.4
    name: Template System
    area: Experience
    description: Template catalog, instantiation from templates, page-type starter packs.
    status: planned
    dependencies:
      - experience-11.3
    required_previous_phase: experience-11.3
    required_documents:
      - docs/experience-roadmap.md
      - docs/phases/Experience/README.md
    required_services:
      - experience
    completion_criteria:
      - Template APIs + validators + tests green
      - No forms/surveys engine yet

  - id: experience-11.5
    name: Localization, RTL/LTR & Media
    area: Experience
    description: Locales, RTL/LTR, media references via Storage only (no binaries in experience_db).
    status: planned
    dependencies:
      - experience-11.4
    required_previous_phase: experience-11.4
    required_documents:
      - docs/experience-roadmap.md
      - docs/phases/Experience/README.md
    required_services:
      - experience
    completion_criteria:
      - Localization and media-ref APIs + isolation tests green
      - No form/survey/appointment engines yet

  - id: experience-11.6
    name: Forms, Surveys & Appointments
    area: Experience
    description: Forms, surveys, appointment page shells; submission/booking refs via APIs/events only.
    status: planned
    dependencies:
      - experience-11.5
    required_previous_phase: experience-11.5
    required_documents:
      - docs/experience-roadmap.md
      - docs/phases/Experience/README.md
    required_services:
      - experience
    completion_criteria:
      - Forms/surveys/appointment APIs + tests green
      - No deep CRM/scheduling ownership; refs only

  - id: experience-11.7
    name: Publishing, Domains, SEO & PWA
    area: Experience
    description: Publish workflows, custom domain binding refs, SEO metadata/sitemap/robots shells, PWA readiness.
    status: planned
    dependencies:
      - experience-11.6
    required_previous_phase: experience-11.6
    required_documents:
      - docs/experience-roadmap.md
      - docs/phases/Experience/README.md
      - docs/architecture/adr/ADR-009.md
    required_services:
      - experience
    completion_criteria:
      - Publishing/SEO/PWA APIs + tests green
      - DNS/SSL edge remains Core/Nginx patterns; Experience stores binding refs

  - id: experience-11.8
    name: Bundles, Licensing & Feature Toggles
    area: Experience
    description: Capability bundles (Mini Site, Menu, Bio Link, …), licensing shells, feature toggles coordinated with Core entitlement.
    status: planned
    dependencies:
      - experience-11.7
    required_previous_phase: experience-11.7
    required_documents:
      - docs/experience-roadmap.md
      - docs/phases/Experience/README.md
    required_services:
      - experience
    completion_criteria:
      - Bundles/toggles APIs + validators + tests green
      - No Core plan-engine ownership

  - id: experience-11.9
    name: Consumer Integrations & Widgets
    area: Experience
    description: Consumer connector contracts for Hospitality/Marketplace/Sports/CRM/etc., embeddable widgets, Communication notify client.
    status: planned
    dependencies:
      - experience-11.8
      - communication-8
    required_previous_phase: experience-11.8
    required_documents:
      - docs/experience-roadmap.md
      - docs/architecture/adr/ADR-012.md
      - docs/architecture/adr/ADR-016.md
    required_services:
      - experience
      - communication
    completion_criteria:
      - Connector + widget contracts documented/tested
      - No SMS provider ownership; UI remains in frontend

  - id: experience-11.10
    name: Analytics, AI Content & Enterprise Validation
    area: Experience
    description: Analytics shells, optional AI content hooks, full AI Framework validation — architecture, security, performance, docs, integration, tenant isolation, migration, API compatibility, self-heal until green.
    status: planned
    dependencies:
      - experience-11.9
      - ai-framework
    required_previous_phase: experience-11.9
    required_documents:
      - docs/experience-roadmap.md
      - docs/phases/Experience/README.md
      - docs/ai-framework/quality-gates.md
      - docs/ai-framework/phase-handover.md
      - docs/architecture/ai-architecture.md
    required_services:
      - experience
    completion_criteria:
      - All Experience quality gates passed
      - Core flows work when AI is off
      - Module registry version/phase updated; progress marks 11.10 complete
      - No undocumented public API/event/permission

  # --- Hospitality (Phase 12.0+) — Torbat Food ---
  - id: hospitality-12.0
    name: Hospitality Platform Foundation
    area: Hospitality
    description: Independent hospitality service scaffold, hospitality_db, health/capabilities, bundle licensing + feature toggles, venue/menu/table shells, permissions hospitality.*, publish-only events, tenant isolation, audit shell. Commercial product Torbat Food.
    status: complete
    dependencies:
      - onboarding-4
      - ai-framework
    required_previous_phase: ai-framework
    required_documents:
      - docs/hospitality-roadmap.md
      - docs/phases/Hospitality/README.md
      - docs/architecture/adr/ADR-017.md
      - docs/hospitality-phase-12-0.md
      - docs/phase-handover/phase-12-0.md
      - docs/ai-framework/service-template.md
      - docs/ai-framework/phase-template.md
    required_services:
      - hospitality
    completion_criteria:
      - Service scaffold under backend/services/hospitality with API → Service → Repository → Model layering
      - Alembic initial migration for foundation tables only as scoped
      - Health + capabilities endpoints; permission tree hospitality.* documented
      - Bundle definitions + tenant bundle activation + feature toggles
      - Tenant isolation + architecture + docs tests green
      - Module registry, manifests, progress, handover updated
      - Quality gates passed; no POS/kitchen/ordering engines

  - id: hospitality-12.1
    name: Digital Menu Catalog
    area: Hospitality
    description: Deep digital menu catalog — modifiers, allergens, availability windows, media refs, multi-language shells.
    status: complete
    dependencies:
      - hospitality-12.0
    required_previous_phase: hospitality-12.0
    required_documents:
      - docs/hospitality-roadmap.md
      - docs/phases/Hospitality/README.md
      - docs/hospitality-phase-12-1.md
      - docs/phase-handover/phase-12-1.md
      - docs/ai-framework/module-template.md
    required_services:
      - hospitality
    completion_criteria:
      - Digital menu catalog APIs + validators + tests green
      - No POS / kitchen / ordering engines yet
      - Module registry, manifests, progress, handover updated
      - Quality gates passed

  - id: hospitality-12.2
    name: QR Menu & QR Ordering
    area: Hospitality
    description: QR Menu public surfaces and QR Ordering shells consuming the digital menu catalog.
    status: planned
    dependencies:
      - hospitality-12.1
    required_previous_phase: hospitality-12.1
    required_documents:
      - docs/hospitality-roadmap.md
      - docs/phases/Hospitality/README.md
      - docs/ai-framework/module-template.md
    required_services:
      - hospitality
    completion_criteria:
      - QR Menu / Ordering APIs + validators + tests green
      - No POS / kitchen engines yet

  # Historical alias — superseded by hospitality-12.0
  - id: restaurant-foundation
    name: Restaurant / Cafe Foundation (superseded)
    area: Restaurant
    status: complete
    notes: Superseded by hospitality-12.0 (Hospitality Platform / Torbat Food). Kept for manifest continuity.
    dependencies:
      - onboarding-4
      - ai-framework
    required_documents:
      - docs/hospitality-phase-12-0.md
      - docs/phases/Restaurant/README.md
    required_services:
      - hospitality

  # --- Marketplace / Ecommerce ---
  - id: ecommerce-foundation
    name: Ecommerce Foundation
    area: Marketplace
    status: planned
    dependencies:
      - onboarding-4
      - ai-framework
    required_documents:
      - docs/phases/Marketplace/README.md
    required_services:
      - ecommerce

  - id: marketplace-foundation
    name: Marketplace Foundation
    area: Marketplace
    status: planned
    dependencies:
      - ecommerce-foundation
      - ai-framework
    required_documents:
      - docs/phases/Marketplace/README.md
    required_services:
      - marketplace

  # --- Automation ---
  - id: automation-foundation
    name: Automation Engine Foundation
    area: Automation
    status: planned
    dependencies:
      - ai-framework
    required_documents:
      - docs/phases/Automation/README.md
      - docs/architecture/event-driven-architecture.md
    required_services:
      - automation

  # --- Academy ---
  - id: academy-foundation
    name: Academy Foundation
    area: Academy
    status: planned
    dependencies:
      - ai-framework
    required_documents:
      - docs/phases/Future/README.md
      - docs/ai-framework/service-template.md
    required_services:
      - academy

  # --- Clinic ---
  - id: clinic-foundation
    name: Clinic / Healthcare Foundation
    area: Clinic
    status: planned
    dependencies:
      - ai-framework
    required_documents:
      - docs/phases/Future/README.md
      - docs/ai-framework/service-template.md
    required_services:
      - clinic

  # --- Hotel ---
  - id: hotel-foundation
    name: Hotel Foundation
    area: Hotel
    status: planned
    dependencies:
      - ai-framework
    required_documents:
      - docs/phases/Future/README.md
      - docs/ai-framework/service-template.md
    required_services:
      - hotel

  # --- Tourism ---
  - id: tourism-foundation
    name: Tourism Foundation
    area: Tourism
    status: planned
    dependencies:
      - ai-framework
    required_documents:
      - docs/phases/Future/README.md
      - docs/ai-framework/service-template.md
    required_services:
      - tourism

  # --- Product AI ---
  - id: ai-assistant-foundation
    name: AI Assistant Foundation
    area: AI
    status: planned
    dependencies:
      - ai-framework
    required_documents:
      - docs/architecture/ai-architecture.md
      - docs/phases/AI/README.md
      - docs/ai-framework/service-template.md
    required_services:
      - ai_assistant

  # --- Future Services ---
  - id: future-services
    name: Future Services Portfolio
    area: Future Services
    status: planned
    dependencies:
      - ai-framework
    required_documents:
      - docs/phases/Future/README.md
      - docs/roadmap.md
    required_services: []
    notes: Catch-all for live_chat, smart_messenger, notification, file_storage, link_shortener, historical website_builder scaffold, and unlisted future modules. Prefer experience (ADR-016) for page/site work.
