feat: extensible participant status determination for booking creation
Adds a rule-based system to determine participant status in CREATE payloads. Participants selecting a 'Begleitperson' service now receive status 'O' (Option), all others default to 'F' (Final). - Add ParticipantStatusRuleInterface for defining status rules - Add ParticipantStatusRuleRegistry for priority-based rule evaluation - Add ChaperonServiceStatusRule for Begleitperson detection - Integrate status evaluation into BookingPayloadBuilder
This commit is contained in:
1 parent
e1f1b60608
commit
c1425f0562
10 files changed
+525
-4
No files matched your search
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\BusProNet\Service\Contract;
|
||||
|
||||
use App\Form\Model\ParticipantDto;
|
||||
|
||||
/**
|
||||
* Defines the contract for participant status evaluation rules.
|
||||
*
|
||||
* Status rules are evaluated in priority order to determine the appropriate
|
||||
* status code for a participant during booking creation. The first rule that
|
||||
* matches (evaluate returns true) determines the participant's status.
|
||||
*/
|
||||
interface ParticipantStatusRuleInterface
|
||||
{
|
||||
/**
|
||||
* Evaluates whether this rule applies to the given participant.
|
||||
*
|
||||
* @param ParticipantDto $participant The participant to evaluate
|
||||
*
|
||||
* @return bool True if this rule applies, false otherwise
|
||||
*/
|
||||
public function evaluate(ParticipantDto $participant): bool;
|
||||
|
||||
/**
|
||||
* Returns the status code to assign when this rule matches.
|
||||
*
|
||||
* @return string The status code (e.g., 'O' for Option, 'F' for Final)
|
||||
*/
|
||||
public function getStatus(): string;
|
||||
|
||||
/**
|
||||
* Returns the priority of this rule.
|
||||
*
|
||||
* Higher priority rules are evaluated first. Rules with the same priority
|
||||
* are evaluated in registration order.
|
||||
*
|
||||
* @return int The priority value (higher = evaluated first)
|
||||
*/
|
||||
public function getPriority(): int;
|
||||
|
||||
/**
|
||||
* Returns a human-readable description of this rule.
|
||||
*
|
||||
* Used for debugging and logging purposes.
|
||||
*
|
||||
* @return string Description of what this rule checks
|
||||
*/
|
||||
public function getDescription(): string;
|
||||
}
|
||||
Reference in new issue
Block a user