Files
server/shared/lib/Mail/Service/ServiceEntityMutableInterface.php
Sebastian Krupinski 88c72542f2
All checks were successful
JS Unit Tests / test (pull_request) Successful in 26s
Build Test / build (pull_request) Successful in 28s
PHP Unit Tests / test (pull_request) Successful in 53s
fix: minor issues
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
2026-04-25 15:46:51 -04:00

102 lines
3.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;
/**
* 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 extends ServiceBaseInterface {
public const CAPABILITY_ENTITY_CREATE = 'EntityCreate';
public const CAPABILITY_ENTITY_MODIFY = 'EntityModify';
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 entityModify(string|int $collection, string|int $identifier, EntityMutableInterface $entity): EntityBaseInterface;
/**
* Deletes entities
*
* @since 2026.04.01
*
* @param EntityIdentifier ...$identifiers Source entities to delete
*
* @return array<string|int,bool|string> Results keyed by entity identifier (true on success, error string on failure)
*/
public function entityDelete(EntityIdentifier ...$identifiers): array;
/**
* Copies entities to another collection
*
* @since 2025.05.01
*
* @param CollectionIdentifier $target Target collection identifier
* @param EntityIdentifier ...$identifiers Source entities to copy
*
* @return array<string|int,bool> List of copied entity identifiers
*/
public function entityCopy(CollectionIdentifier $target, EntityIdentifier ...$identifiers): array;
/**
* Moves entities to another collection
*
* @since 2025.05.01
*
* @param CollectionIdentifier $target Target collection identifier
* @param EntityIdentifier ...$identifiers Source entities to move
*
* @return array<string|int,bool> List of moved entity identifiers
*/
public function entityMove(CollectionIdentifier $target, EntityIdentifier ...$identifiers): array;
}