Lands the v1.0 purpose registry (WS-2 of the consolidation sprint) as a first-class concept: a `PurposeDefinition` value object, a `PurposeRegistry` service keyed by slug, and a declarative `config/form_builder/purposes.php` registry with exactly the seven purposes from ARCH-CONSOLIDATION §6.4. Also rebuilds the morph-map in `AppServiceProvider::boot` into three labelled blocks: (1) domain subject types derived from `PurposeRegistry::allSubjectTypes()`, (2) non-purpose domain types hardcoded with comments (form_schemas owner_types, activity-log subjects), (3) framework types (spatie/activitylog; Sanctum stays absent per addendum Q4). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
86 lines
2.8 KiB
PHP
86 lines
2.8 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Enums\FormBuilder\FormSubmissionMode;
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Form Builder — Purpose registry (v1.0)
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| Declarative set of purposes served by the universal form builder. v1.0
|
|
| ships seven purposes. Adding a new purpose requires a code change (this
|
|
| file) plus, typically, a new listener — per ARCH-CONSOLIDATION §3
|
|
| besluit 4. Purposes are not user-defined.
|
|
|
|
|
| Each purpose declares:
|
|
| - label (NL): organizer-facing label
|
|
| - subject_type: morph alias used for form_submissions.subject_type
|
|
| - default_submission_mode: FormSubmissionMode enum case
|
|
| - allows_public_access: schema-level public submission without token
|
|
| - required_bindings: list of "{entity}.{attribute}" binding paths
|
|
| that must be present on a schema before publish
|
|
|
|
|
*/
|
|
|
|
return [
|
|
|
|
'event_registration' => [
|
|
'label' => 'Aanmelding vrijwilligers/crew',
|
|
'subject_type' => 'person',
|
|
'default_submission_mode' => FormSubmissionMode::SINGLE,
|
|
'allows_public_access' => true,
|
|
'required_bindings' => ['person.email', 'person.first_name', 'person.last_name'],
|
|
],
|
|
|
|
'artist_advance' => [
|
|
'label' => 'Artiest advance',
|
|
'subject_type' => 'artist',
|
|
'default_submission_mode' => FormSubmissionMode::DRAFT_SINGLE,
|
|
'allows_public_access' => false,
|
|
'required_bindings' => [],
|
|
],
|
|
|
|
'supplier_intake' => [
|
|
'label' => 'Leverancier intake',
|
|
'subject_type' => 'company',
|
|
'default_submission_mode' => FormSubmissionMode::SINGLE,
|
|
'allows_public_access' => false,
|
|
'required_bindings' => ['company.name'],
|
|
],
|
|
|
|
'post_event_evaluation' => [
|
|
'label' => 'Evaluatie na afloop',
|
|
'subject_type' => 'person',
|
|
'default_submission_mode' => FormSubmissionMode::SINGLE,
|
|
'allows_public_access' => false,
|
|
'required_bindings' => [],
|
|
],
|
|
|
|
'incident_report' => [
|
|
'label' => 'Incident-melding',
|
|
'subject_type' => 'person',
|
|
'default_submission_mode' => FormSubmissionMode::MULTIPLE,
|
|
'allows_public_access' => false,
|
|
'required_bindings' => [],
|
|
],
|
|
|
|
'signature_contract' => [
|
|
'label' => 'Contract-ondertekening',
|
|
'subject_type' => 'user',
|
|
'default_submission_mode' => FormSubmissionMode::SINGLE,
|
|
'allows_public_access' => false,
|
|
'required_bindings' => [],
|
|
],
|
|
|
|
'user_profile' => [
|
|
'label' => 'Profiel-update',
|
|
'subject_type' => 'user',
|
|
'default_submission_mode' => FormSubmissionMode::SINGLE,
|
|
'allows_public_access' => false,
|
|
'required_bindings' => [],
|
|
],
|
|
|
|
];
|