Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
1 / 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\Modules\Structure\Application\Service;
8
9defined('AMMONLY_APP') || exit('Direct script access is forbidden.');
10
11/**
12 * Structure Reassignment Contract Interface.
13 *
14 * @package App\Modules\Structure\Application\Service
15 */
16interface StructureReassignmentServiceInterface
17{
18    /**
19     * Checks whether a structure node can be safely deleted without reassignment.
20     *
21     * @param int $structureId Structure node ID.
22     * @return array{can_delete: bool, record_count: int, user_count: int, child_count: int}
23     */
24    public function canDeleteStructure(int $structureId): array;
25
26    /**
27     * Reassigns all dependencies of a structure node to target node and deletes the source.
28     *
29     * @param int $sourceStructureId Source structure node ID to delete.
30     * @param int $targetStructureId Target structure node ID to receive dependencies.
31     */
32    public function reassignAndRemoveStructure(int $sourceStructureId, int $targetStructureId): void;
33
34    /**
35     * Checks whether a user can be safely deleted without reassignment.
36     *
37     * @param int $userId Target user ID.
38     * @return array{can_delete: bool, record_count: int}
39     */
40    public function canDeleteUser(int $userId): array;
41
42    /**
43     * Reassigns all records owned by user to target user and removes user assignments.
44     *
45     * @param int $sourceUserId Source user ID.
46     * @param int $targetUserId Target user ID to receive records.
47     */
48    public function reassignAndRemoveUser(int $sourceUserId, int $targetUserId): void;
49}