Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
1 / 1 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | /** @license For full copyright and license information, please see the LICENSE.md file. */ |
| 6 | |
| 7 | namespace App\Core\ModuleBuilder\Application\Service; |
| 8 | |
| 9 | defined('AMMONLY_APP') || exit('Direct script access is forbidden.'); |
| 10 | |
| 11 | use App\Core\Engine\Domain\Model\PermissionContext; |
| 12 | use App\Core\ModuleBuilder\Domain\Model\ModuleDefinitionDto; |
| 13 | |
| 14 | /** |
| 15 | * Module Builder Service Contract. |
| 16 | * |
| 17 | * @package App\Core\ModuleBuilder\Application\Service |
| 18 | */ |
| 19 | interface ModuleBuilderServiceInterface |
| 20 | { |
| 21 | /** |
| 22 | * Creates a new module with physical SQL table, sections, fields, filters, and relations. |
| 23 | * |
| 24 | * @param ModuleDefinitionDto $definition |
| 25 | * @param PermissionContext|null $context |
| 26 | * @return int Newly created module ID. |
| 27 | */ |
| 28 | public function createModule(ModuleDefinitionDto $definition, ?PermissionContext $context = null): int; |
| 29 | |
| 30 | /** |
| 31 | * Updates an existing module and applies delta alterations to physical table. |
| 32 | * |
| 33 | * @param int $moduleId |
| 34 | * @param ModuleDefinitionDto $definition |
| 35 | * @param PermissionContext|null $context |
| 36 | */ |
| 37 | public function updateModule( |
| 38 | int $moduleId, |
| 39 | ModuleDefinitionDto $definition, |
| 40 | ?PermissionContext $context = null, |
| 41 | ): void; |
| 42 | |
| 43 | /** |
| 44 | * Loads full composite module definition for the wizard in edit mode. |
| 45 | * |
| 46 | * @param int $moduleId |
| 47 | * @param PermissionContext|null $context |
| 48 | * @return ModuleDefinitionDto |
| 49 | */ |
| 50 | public function getModuleDefinition(int $moduleId, ?PermissionContext $context = null): ModuleDefinitionDto; |
| 51 | |
| 52 | /** |
| 53 | * Deletes an existing module along with all metadata and optional physical table. |
| 54 | * |
| 55 | * @param int $moduleId Target module ID. |
| 56 | * @param bool $dropTable Whether to drop physical SQL table (default true). |
| 57 | * @param PermissionContext|null $context Permission context. |
| 58 | */ |
| 59 | public function deleteModule( |
| 60 | int $moduleId, |
| 61 | bool $dropTable = true, |
| 62 | ?PermissionContext $context = null, |
| 63 | ): void; |
| 64 | |
| 65 | /** |
| 66 | * Returns dictionary metadata for wizard dropdowns (UiTypes, picklists, target modules). |
| 67 | * |
| 68 | * @param PermissionContext|null $context |
| 69 | * @return array<string, mixed> |
| 70 | */ |
| 71 | public function getBuilderMetadata(?PermissionContext $context = null): array; |
| 72 | } |
| 73 |