refactor: people interfaces to unified design

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-06-20 19:04:39 -04:00
parent 802849a60d
commit a6e2a447e5
13 changed files with 148 additions and 72 deletions
@@ -11,9 +11,11 @@ namespace KTXF\People\Service;
use KTXF\People\Collection\CollectionBaseInterface;
use KTXF\People\Collection\CollectionMutableInterface;
use KTXF\People\Collection\CollectionPropertiesBaseInterface;
use KTXF\Resource\Identifier\CollectionIdentifierInterface;
/**
* Service Collection Mutable Interface
* People Service Collection Mutable Interface
*
* Optional interface for services that support collection CRUD operations.
*
@@ -39,37 +41,36 @@ interface ServiceCollectionMutableInterface {
*
* @since 2025.05.01
*
* @param string|int|null $location Parent collection ID (null for root)
* @param CollectionMutableInterface $collection Collection to create
* @param CollectionIdentifierInterface|null $target Target collection identifier (parent)
* @param CollectionPropertiesBaseInterface $properties Collection properties
* @param array $options Protocol-specific options
*
* @return CollectionBaseInterface Created collection with assigned ID
*/
public function collectionCreate(string|int|null $location, CollectionMutableInterface $collection, array $options = []): CollectionBaseInterface;
public function collectionCreate(CollectionIdentifierInterface|null $target, CollectionPropertiesBaseInterface $properties, array $options = []): CollectionBaseInterface;
/**
* Updates an existing collection
*
* @since 2025.05.01
*
* @param string|int $identifier Collection ID
* @param CollectionMutableInterface $collection Updated collection data
* @param CollectionIdentifierInterface $target Target collection identifier
* @param CollectionPropertiesBaseInterface $properties Updated collection data
*
* @return CollectionBaseInterface Updated collection
*/
public function collectionUpdate(string|int $identifier, CollectionMutableInterface $collection): CollectionBaseInterface;
public function collectionUpdate(CollectionIdentifierInterface $target, CollectionPropertiesBaseInterface $properties): CollectionBaseInterface;
/**
* Deletes a collection
*
* @since 2025.05.01
*
* @param string|int $identifier Collection ID
* @param CollectionIdentifierInterface $target Target collection identifier
* @param bool $force Force deletion even if not empty
* @param bool $recursive Recursively delete contents
*
* @return bool True if deleted
* @return CollectionBaseInterface|true Collection object on soft delete, true on hard delete
*/
public function collectionDelete(string|int $identifier, bool $force = false, bool $recursive = false): bool;
public function collectionDelete(CollectionIdentifierInterface $target, bool $force = false): CollectionBaseInterface | true;
}