* SPDX-License-Identifier: AGPL-3.0-or-later */ namespace KTXF\Mail\Service; use KTXF\Mail\Collection\CollectionBaseInterface; use KTXF\Mail\Collection\CollectionMutableInterface; /** * Mail Service Collection Mutable Interface * * Optional interface for services that support collection CRUD operations. * Provides mailbox/folder creation, modification, deletion, and moving. * * @since 2025.05.01 */ interface ServiceCollectionMutableInterface extends ServiceBaseInterface { public const CAPABILITY_COLLECTION_CREATE = 'CollectionCreate'; public const CAPABILITY_COLLECTION_MODIFY = 'CollectionModify'; public const CAPABILITY_COLLECTION_DESTROY = 'CollectionDestroy'; public const CAPABILITY_COLLECTION_MOVE = 'CollectionMove'; /** * 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; /** * Modifies an existing collection * * @since 2025.05.01 * * @param string|int $identifier Collection ID * @param CollectionMutableInterface $collection Updated collection data * * @return CollectionBaseInterface Modified collection */ public function collectionModify(string|int $identifier, CollectionMutableInterface $collection): CollectionBaseInterface; /** * Destroys a collection * * @since 2025.05.01 * * @param string|int $identifier Collection ID * @param bool $force Force destruction even if not empty * @param bool $recursive Recursively destroy contents * * @return bool True if destroyed */ public function collectionDestroy(string|int $identifier, bool $force = false, bool $recursive = false): bool; /** * Moves a collection to a new parent * * @since 2025.05.01 * * @param string|int $identifier Collection ID * @param string|int|null $targetLocation New parent ID (null for root) * * @return CollectionBaseInterface Moved collection */ public function collectionMove(string|int $identifier, string|int|null $targetLocation): CollectionBaseInterface; }