Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 1
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2
3declare(strict_types=1);
4
5/** @license For full copyright and license information, please see the LICENSE.md file. */
6
7namespace App\Core\Engine\Domain\Service;
8
9defined('AMMONLY_APP') || exit('Direct script access is forbidden.');
10
11use App\Core\Engine\Domain\Model\PermissionContext;
12
13/**
14 * Workflow Engine Contract.
15 *
16 * Defines the interface for invoking workflow lifecycle hooks
17 * during CRUD operations in UniversalCrudService.
18 *
19 * @package App\Core\Engine\Domain\Service
20 */
21interface WorkflowEngineInterface
22{
23    /**
24     * Executes synchronous before-save/delete workflow hooks.
25     *
26     * @param string                    $moduleName  Machine module name.
27     * @param string                    $triggerType Stage: 'before_create' | 'before_update' | 'before_delete'.
28     * @param array<string, mixed>      $data        Active payload to be saved or modified.
29     * @param array<string, mixed>|null $snapshot    Previous database snapshot (for update/delete).
30     * @param PermissionContext         $context     Security context of the executing user.
31     * @return array<string, mixed> Potentially modified data payload.
32     */
33    public function executeBeforeHook(
34        string            $moduleName,
35        string            $triggerType,
36        array             $data,
37        ?array            $snapshot,
38        PermissionContext $context
39    ): array;
40}