Remove the policy, package, course, cancellation and event subsystems

The product owner scoped the booking model down to resources, services and
service options; everything else goes. Deleted, with their tables, tests, panel
pages and API routes:

  src/Policy      27 files   policy engine, simulation, templates
  src/Package     13 files   packages and the credit ledger
  src/Course      14 files   treatment protocols and courses
  src/Cancellation + src/Waitlist  19 files  penalties, no-shows, waitlist
  src/Report + src/Shared/Event    events outbox and the two reports

The surviving code had hooks into all of them, so this is not only deletion:

- AppointmentPlanBuilder loses the timing and resource policy passes, and the
  requirement-from-policy builder that had no other caller (449 → 379 lines)
- PricingEngine loses policy discounts and package coverage; PriceQuote loses
  its package fields and quote() its patient argument, which existed only to
  find a usable package
- BookingService no longer consumes credit, unlinks course sessions or emits
  events; HoldService and ResourceBlockController stop emitting too
- ServiceSelectionValidator keeps groups and relations, drops the policy layer
- the appointment loses its course_session link

Cancelling an appointment still works and still records who and why — it moves
through PATCH /api/v1/appointment/{uuid}/status. What it no longer does is
compute a penalty, so the panel dialog is a plain confirm now. That is the
visible cost of this change and it is intended, not an oversight.

The drop migration uses DROP TABLE IF EXISTS with foreign-key checks off: a
half-applied earlier run left some tables already gone, and a migration that
only works from a pristine schema is a trap on any environment that was
interrupted. messenger_messages is deliberately left alone — it is Symfony's,
not ours.

Suite green at 1258 tests, slot-mode-frozen green, phpstan back to its 14-error
baseline after removing two now-unused members it caught, tsc clean, and
app:seed-scenarios still builds all three environments.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
hamed
2026-08-01 20:51:41 +03:30
co-authored by Claude Opus 5
parent c4f1f25c80
commit 8280aa7578
@@ -116,20 +116,20 @@
| # | مورد | وضعیت | یادداشت |
|---|---|---|---|
| ۸.۱ | `src/Policy/` حذف شد | | |
| ۸.۲ | `src/Package/` حذف شد | | |
| ۸.۳ | `src/Course/` حذف شد | | |
| ۸.۴ | `src/Cancellation/` + `src/Waitlist/` حذف شد | | |
| ۸.۵ | `src/Report/` + `src/Shared/Event/` حذف شد | | |
| ۸.۶ | قلاب‌ها از `AppointmentPlanBuilder` کنده شد | | |
| ۸.۷ | قلاب‌ها از `PricingEngine` کنده شد | | |
| ۸.۸ | قلاب‌ها از `BookingController` و `BookingService` کنده شد | | |
| ۸.۹ | قلاب‌ها از `ServiceSelectionValidator` کنده شد | | |
| ۸.۱۰ | `GlobalTables` و seeder پاک‌سازی شد | | |
| ۸.۱۱ | صفحات پنل و مسیرهای `App.tsx` حذف شد | | |
| ۸.۱۲ | migration `DROP TABLE` با `down()` واقعی | | |
| ۸.۱۳ | `debug:router` صفر مسیر حذف‌شده | | |
| ۸.۱۴ | تست‌های دامنه‌های حذف‌شده پاک شد | | |
| ۸.۱ | `src/Policy/` حذف شد | | `src/Policy/` (۲۷ فایل) حذف شد |
| ۸.۲ | `src/Package/` حذف شد | | `src/Package/` (۱۳ فایل) حذف شد |
| ۸.۳ | `src/Course/` حذف شد | | `src/Course/` (۱۴ فایل) حذف شد |
| ۸.۴ | `src/Cancellation/` + `src/Waitlist/` حذف شد | | `src/Cancellation/` + `src/Waitlist/` (۱۹ فایل) حذف شد |
| ۸.۵ | `src/Report/` + `src/Shared/Event/` حذف شد | | `src/Report/` + `src/Shared/Event/` حذف شد |
| ۸.۶ | قلاب‌ها از `AppointmentPlanBuilder` کنده شد | | `applyTimingPolicies`/`applyResourcePolicies`/`requirementForRole` برداشته شد — ۴۴۹ → ۳۷۹ خط |
| ۸.۷ | قلاب‌ها از `PricingEngine` کنده شد | | تخفیف سیاستی و پوشش پکیج از `PricingEngine` و `PriceQuote` رفت |
| ۸.۸ | قلاب‌ها از `BookingController` و `BookingService` کنده شد | | `BookingPolicyGuard`، `PackageConsumption`، `CreditLedger`، `CourseSessionLinker` و رویدادها کنده شد |
| ۸.۹ | قلاب‌ها از `ServiceSelectionValidator` کنده شد | | `policyErrors()` از validator رفت؛ گروه و رابطه دست‌نخورده ماند |
| ۸.۱۰ | `GlobalTables` و seeder پاک‌سازی شد | | `GlobalTables`، سیدر، `Schedule.php` و `messenger.yaml` پاک شد |
| ۸.۱۱ | صفحات پنل و مسیرهای `App.tsx` حذف شد | | ۱۱ صفحهٔ پنل + مسیرها + منوی تنظیمات + هوک‌ها + تایپ‌ها حذف شد |
| ۸.۱۲ | migration `DROP TABLE` با `down()` واقعی | | `Version20260801170043` — ۱۵ جدول با `IF EXISTS`، ستون `course_session_id` نوبت |
| ۸.۱۳ | `debug:router` صفر مسیر حذف‌شده | | ۵ مسیر باقی‌مانده مربوط به «پکیج انبار» و «گزارش بیمه» است، نه دامنه‌های حذف‌شده |
| ۸.۱۴ | تست‌های دامنه‌های حذف‌شده پاک شد | | `tests/{Policy,Package,Course,Cancellation,Waitlist,Report}` + assertionهای رویداد در دو تست |
## ۹. مستندات