* SPDX-License-Identifier: AGPL-3.0-or-later */ namespace KTXF\People\Service; use KTXF\People\Entity\EntityBaseInterface; use KTXF\People\Entity\EntityMutableInterface; /** * Service Entity Mutable Interface * * Optional interface for services that support entity CRUD operations. * * @since 2025.05.01 */ interface ServiceEntityMutableInterface { public const CAPABILITY_ENTITY_CREATE = 'EntityCreate'; public const CAPABILITY_ENTITY_UPDATE = 'EntityUpdate'; public const CAPABILITY_ENTITY_DELETE = 'EntityDelete'; public const CAPABILITY_ENTITY_COPY = 'EntityCopy'; public const CAPABILITY_ENTITY_MOVE = 'EntityMove'; /** * Creates a fresh entity instance for composition * * @since 2025.05.01 * * @return EntityMutableInterface Fresh entity object */ public function entityFresh(): EntityMutableInterface; /** * Creates/imports an entity into a collection * * @since 2025.05.01 * * @param string|int $collection collection identifier * @param EntityMutableInterface $entity Entity data * @param array $options additional options * * @return EntityBaseInterface Created entity */ public function entityCreate(string|int $collection, EntityMutableInterface $entity, array $options = []): EntityBaseInterface; /** * Modifies an existing entity * * @since 2025.05.01 * * @param string|int $collection Collection identifier * @param string|int $identifier Entity identifier * @param EntityMutableInterface $entity Entity data * * @return EntityBaseInterface Modified entity */ public function entityUpdate(string|int $collection, string|int $identifier, EntityMutableInterface $entity): EntityBaseInterface; /** * Deletes an existing entity in the specified collection * * @since 2025.05.01 * * @param string|int $collection Collection identifier * @param string|int $identifier Entity identifier to delete * * @return EntityBaseInterface Deleted entity */ public function entityDelete(string|int $collection, string|int $identifier): EntityBaseInterface; }