* SPDX-License-Identifier: AGPL-3.0-or-later */ namespace KTXF\Mail\Service; use KTXF\Mail\Collection\CollectionBaseInterface; use KTXF\Mail\Collection\CollectionMutableInterface; use KTXF\Mail\Collection\CollectionPropertiesBaseInterface; use KTXF\Resource\Identifier\CollectionIdentifier; /** * 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 { public const CAPABILITY_COLLECTION_CREATE = 'CollectionCreate'; public const CAPABILITY_COLLECTION_UPDATE = 'CollectionUpdate'; public const CAPABILITY_COLLECTION_DELETE = 'CollectionDelete'; 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 CollectionIdentifier $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(CollectionIdentifier|null $target, CollectionPropertiesBaseInterface $properties, array $options = []): CollectionBaseInterface; /** * Updates an existing collection * * @since 2025.05.01 * * @param CollectionIdentifier $target Target collection identifier * @param CollectionPropertiesBaseInterface $properties Updated collection data * * @return CollectionBaseInterface Updated collection */ public function collectionUpdate(CollectionIdentifier $target, CollectionPropertiesBaseInterface $properties): CollectionBaseInterface; /** * Deletes a collection * * @since 2025.05.01 * * @param CollectionIdentifier $target Target collection identifier * @param bool $force Force deletion even if not empty * * @return CollectionBaseInterface|true Collection object on soft delete, true on hard delete */ public function collectionDelete(CollectionIdentifier $target, bool $force = false): CollectionBaseInterface | true; /** * Moves a collection to a new parent * * @since 2025.05.01 * * @param CollectionIdentifier $source Source collection identifier * @param CollectionIdentifier $target Target collection identifier * * @return CollectionBaseInterface Moved collection */ public function collectionMove(CollectionIdentifier $target, CollectionIdentifier $source): CollectionBaseInterface; }