feat(form-builder): form_field_validation_rules table + polymorphic owner + scope + cascade

This commit is contained in:
2026-04-24 22:01:36 +02:00
parent 87fc964ead
commit fedaed1b32
17 changed files with 798 additions and 37 deletions

View File

@@ -0,0 +1,36 @@
<?php
declare(strict_types=1);
namespace App\Enums\FormBuilder;
/**
* Canonical catalogue of validation rule types stored relationally in
* `form_field_validation_rules` (ARCH-FORM-BUILDER §17.4). One case per
* legacy top-level key in the pre-WS-5b `validation_rules` JSON, minus
* the non-validation entries (`tag_categories`, `storage_disk` moved
* to `form_field_configs` under ARCH §17.5) and the column-duplicates
* (`required`, `unique` source of truth is `is_required` / `is_unique`
* on the parent row).
*
* Per-case `parameters` shape is enforced at the service layer, not by
* the enum see `FormFieldValidationRuleService::assertSpecValid()`.
*/
enum FormFieldValidationRuleType: string
{
case MinLength = 'min_length';
case MaxLength = 'max_length';
case MinValue = 'min_value';
case MaxValue = 'max_value';
case Regex = 'regex';
case EmailFormat = 'email_format';
case UrlFormat = 'url_format';
case PhoneE164 = 'phone_e164';
case AllowedMimeTypes = 'allowed_mime_types';
case MaxFileSize = 'max_file_size';
case MinSelected = 'min_selected';
case MaxSelected = 'max_selected';
case DateMin = 'date_min';
case DateMax = 'date_max';
case Callback = 'callback';
}