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
53 lines
1.5 KiB
PHP
53 lines
1.5 KiB
PHP
<?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;
|
|
}
|