> */ protected static array $map = [ 'add_segment' => AddSegmentHandler::class, 'archive_contract' => \App\Services\DecisionEvents\Handlers\ArchiveContractHandler::class, 'end_field_job' => \App\Services\DecisionEvents\Handlers\EndFieldJobHandler::class, ]; public static function resolve(string $key): DecisionEventHandler { $key = trim(strtolower($key)); $class = static::$map[$key] ?? null; if (! $class || ! class_exists($class)) { throw new InvalidArgumentException("Unknown decision event handler for key: {$key}"); } $handler = app($class); if (! $handler instanceof DecisionEventHandler) { throw new InvalidArgumentException("Handler for key {$key} must implement DecisionEventHandler"); } return $handler; } }