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\Application\Service;
8
9defined('AMMONLY_APP') || exit('Direct script access is forbidden.');
10
11use App\Core\Engine\Domain\Model\PermissionContext;
12
13/**
14 * Universal CRUD Service Interface.
15 *
16 * Contract for engine data operations orchestrating metadata, permissions, and persistence.
17 *
18 * @package App\Core\Engine\Application\Service
19 */
20interface UniversalCrudServiceInterface
21{
22    /**
23     * Reads a single record by module name and primary key.
24     *
25     * @param string $moduleName Target module name.
26     * @param int $recordId Target record ID.
27     * @param PermissionContext $context Caller security context.
28     * @return array<string, mixed> Record data attributes.
29     */
30    public function read(string $moduleName, int $recordId, PermissionContext $context): array;
31
32    /**
33     * Creates a new record in the target module table.
34     *
35     * @param string $moduleName Target module name.
36     * @param array<string, mixed> $data Field values.
37     * @param PermissionContext $context Caller security context.
38     * @return int Primary key of created record.
39     */
40    public function create(string $moduleName, array $data, PermissionContext $context): int;
41
42    /**
43     * Updates an existing record in the target module table.
44     *
45     * @param string $moduleName Target module name.
46     * @param int $recordId Target record ID.
47     * @param array<string, mixed> $data Updated field values.
48     * @param PermissionContext $context Caller security context.
49     * @return void
50     */
51    public function update(string $moduleName, int $recordId, array $data, PermissionContext $context): void;
52
53    /**
54     * Updates record lifecycle status (special_access).
55     *
56     * @param string            $moduleName Module machine name.
57     * @param int               $id         Record primary key.
58     * @param int               $status     Target status code (1=Available, 2=Archived, 3=Deleted).
59     * @param PermissionContext $context    Security context.
60     */
61    public function updateRecordStatus(string $moduleName, int $id, int $status, PermissionContext $context): void;
62}