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\Modules\Structure\Domain\Repository; |
| 8 | |
| 9 | defined('AMMONLY_APP') || exit('Direct script access is forbidden.'); |
| 10 | |
| 11 | /** |
| 12 | * Structure Membership Repository Domain Contract. |
| 13 | * |
| 14 | * Manages M:N assignments between users and organizational structure nodes. |
| 15 | * |
| 16 | * @package App\Modules\Structure\Domain\Repository |
| 17 | */ |
| 18 | interface StructureMembershipRepositoryInterface |
| 19 | { |
| 20 | /** |
| 21 | * Gets all structure node IDs assigned to a specific user. |
| 22 | * |
| 23 | * @param int $userId Target user ID. |
| 24 | * @return array<int, int> List of structure node IDs. |
| 25 | */ |
| 26 | public function getUserStructureIds(int $userId): array; |
| 27 | |
| 28 | /** |
| 29 | * Gets all user IDs assigned to a specific structure node. |
| 30 | * |
| 31 | * @param int $structureId Structure node ID. |
| 32 | * @return array<int, int> List of user IDs. |
| 33 | */ |
| 34 | public function getStructureUserIds(int $structureId): array; |
| 35 | |
| 36 | /** |
| 37 | * Gets assigned users details for a structure node (id, full_name, email). |
| 38 | * |
| 39 | * @param int $structureId Structure node ID. |
| 40 | * @return array<int, array<string, mixed>> List of user records. |
| 41 | */ |
| 42 | public function getStructureUsers(int $structureId): array; |
| 43 | |
| 44 | /** |
| 45 | * Counts how many users are assigned to a specific structure node. |
| 46 | * |
| 47 | * @param int $structureId Structure node ID. |
| 48 | * @return int Assigned users count. |
| 49 | */ |
| 50 | public function countUsersInStructure(int $structureId): int; |
| 51 | |
| 52 | /** |
| 53 | * Assigns a user to a structure node. |
| 54 | * |
| 55 | * @param int $userId User ID. |
| 56 | * @param int $structureId Structure node ID. |
| 57 | * @return void |
| 58 | */ |
| 59 | public function assignUser(int $userId, int $structureId): void; |
| 60 | |
| 61 | /** |
| 62 | * Removes assignment between user and structure node. |
| 63 | * |
| 64 | * @param int $userId User ID. |
| 65 | * @param int $structureId Structure node ID. |
| 66 | * @return void |
| 67 | */ |
| 68 | public function removeUser(int $userId, int $structureId): void; |
| 69 | |
| 70 | /** |
| 71 | * Synchronizes all structure assignments for a given user. |
| 72 | * |
| 73 | * @param int $userId User ID. |
| 74 | * @param array<int, int> $structureIds Target structure IDs list. |
| 75 | * @return void |
| 76 | */ |
| 77 | public function syncUserStructures(int $userId, array $structureIds): void; |
| 78 | |
| 79 | /** |
| 80 | * Synchronizes all user assignments for a given structure node. |
| 81 | * |
| 82 | * @param int $structureId Structure node ID. |
| 83 | * @param array<int, int> $userIds Target user IDs list. |
| 84 | * @return void |
| 85 | */ |
| 86 | public function syncStructureUsers(int $structureId, array $userIds): void; |
| 87 | } |