* SPDX-License-Identifier: AGPL-3.0-or-later */ namespace KTXF\Chrono\Service; use KTXF\Chrono\Collection\CollectionBaseInterface; use KTXF\Chrono\Collection\CollectionMutableInterface; /** * Chrono Service Collection Mutable Interface * * @since 2025.05.01 */ interface ServiceCollectionMutableInterface extends ServiceBaseInterface { public const CAPABILITY_COLLECTION_CREATE = 'CollectionCreate'; public const CAPABILITY_COLLECTION_UPDATE = 'CollectionUpdate'; public const CAPABILITY_COLLECTION_DELETE = 'CollectionDelete'; /** * Creates a fresh collection instance for configuration * * @since 2025.05.01 * * @return CollectionMutableInterface Fresh collection object */ public function collectionFresh(): CollectionMutableInterface; /** * Creates a new collection * * @since 2025.05.01 * * @param string|int|null $location Parent collection ID (null for root) * @param CollectionMutableInterface $collection Collection to create * @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; /** * Updates an existing collection * * @since 2025.05.01 * * @param string|int $identifier Collection ID * @param CollectionMutableInterface $collection Updated collection data * * @return CollectionBaseInterface Updated collection */ public function collectionUpdate(string|int $identifier, CollectionMutableInterface $collection): CollectionBaseInterface; /** * Deletes a collection * * @since 2025.05.01 * * @param string|int $identifier Collection ID * @param bool $force Force deletion even if not empty * @param bool $recursive Recursively delete contents * * @return bool True if deleted */ public function collectionDelete(string|int $identifier, bool $force = false, bool $recursive = false): bool; }