131 lines
4.2 KiB
PHP
131 lines
4.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
/**
|
|
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
*/
|
|
|
|
namespace KTXF\Mail\Service;
|
|
|
|
use KTXF\Mail\Entity\EntityBaseInterface;
|
|
use KTXF\Mail\Entity\EntityMutableInterface;
|
|
use KTXF\Mail\Object\MessagePropertiesMutableInterface;
|
|
use KTXF\Resource\Identifier\CollectionIdentifier;
|
|
use KTXF\Resource\Identifier\EntityIdentifier;
|
|
|
|
/**
|
|
* Mail Service Entity Mutable Interface
|
|
*
|
|
* Optional interface for services that support entity CRUD operations.
|
|
* Provides entity creation, modification, deletion, copying, moving, and flag management.
|
|
*
|
|
* @since 2025.05.01
|
|
*/
|
|
interface ServiceEntityMutableInterface {
|
|
|
|
public const CAPABILITY_ENTITY_CREATE = 'EntityCreate';
|
|
public const CAPABILITY_ENTITY_MODIFY = 'EntityModify';
|
|
public const CAPABILITY_ENTITY_DELETE = 'EntityDelete';
|
|
public const CAPABILITY_ENTITY_PATCH = 'EntityPatch';
|
|
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 CollectionIdentifier $target Target collection identifier
|
|
* @param MessagePropertiesMutableInterface $properties Entity properties
|
|
* @param array $options Additional options
|
|
*
|
|
* @return EntityBaseInterface Created entity
|
|
*/
|
|
public function entityCreate(CollectionIdentifier $target, MessagePropertiesMutableInterface $properties, array $options = []): EntityBaseInterface;
|
|
|
|
/**
|
|
* Modifies an existing entity
|
|
*
|
|
* @since 2025.05.01
|
|
*
|
|
* @param EntityIdentifier $target Target entity identifier
|
|
* @param MessagePropertiesMutableInterface $properties Entity properties to update
|
|
*
|
|
* @return EntityBaseInterface Modified entity
|
|
*/
|
|
public function entityModify(EntityIdentifier $target, MessagePropertiesMutableInterface $properties): EntityBaseInterface;
|
|
|
|
/**
|
|
* Deletes entities
|
|
*
|
|
* @since 2026.04.01
|
|
*
|
|
* @param EntityIdentifier ...$targets Source entities to delete
|
|
*
|
|
* @return array<string, array{
|
|
* disposition: 'moved'|'deleted'|'error',
|
|
* destination: ?CollectionIdentifier,
|
|
* mutation: EntityIdentifier
|
|
* }> Results keyed by source entity identifier
|
|
*/
|
|
public function entityDelete(EntityIdentifier ...$targets): array;
|
|
|
|
/**
|
|
* Patches an existing entity(ies) with partial data
|
|
*
|
|
* @since 2025.05.01
|
|
*
|
|
* @param MessagePropertiesMutableInterface $properties Partial entity properties
|
|
* @param EntityIdentifier ...$targets Source entities to patch
|
|
*
|
|
* @return array<string, array{
|
|
* disposition: 'patched'|'error'
|
|
* }> Results keyed by source entity identifier
|
|
*/
|
|
public function entityPatch(MessagePropertiesMutableInterface $properties, EntityIdentifier ...$targets): array;
|
|
|
|
/**
|
|
* Moves entities to another collection
|
|
*
|
|
* @since 2025.05.01
|
|
*
|
|
* @param CollectionIdentifier $target Target collection identifier
|
|
* @param EntityIdentifier ...$sources Source entities to move
|
|
*
|
|
* @return array<string, array{
|
|
* disposition: 'moved'|'error',
|
|
* destination: ?CollectionIdentifier,
|
|
* mutation: EntityIdentifier
|
|
* }> Results keyed by source entity identifier
|
|
*/
|
|
public function entityMove(CollectionIdentifier $target, EntityIdentifier ...$sources): array;
|
|
|
|
/**
|
|
* Copies entities to another collection
|
|
*
|
|
* @since 2025.05.01
|
|
*
|
|
* @param CollectionIdentifier $target Target collection identifier
|
|
* @param EntityIdentifier ...$sources Source entities to copy
|
|
*
|
|
* @return array<string, array{
|
|
* disposition: 'copied'|'error',
|
|
* destination: ?CollectionIdentifier,
|
|
* mutation: EntityIdentifier
|
|
* }> Results keyed by source entity identifier
|
|
*/
|
|
public function entityCopy(CollectionIdentifier $target, EntityIdentifier ...$sources): array;
|
|
|
|
}
|