* SPDX-License-Identifier: AGPL-3.0-or-later */ namespace KTXF\People\Service; use JsonSerializable; use KTXF\People\Collection\ICollectionBase; use KTXF\Resource\Filter\IFilter; use KTXF\Resource\Range\IRange; use KTXF\Resource\Range\RangeType; use KTXF\Resource\Sort\ISort; interface IServiceBase extends JsonSerializable { public const CAPABILITY_COLLECTION_LIST = 'CollectionList'; public const CAPABILITY_COLLECTION_LIST_FILTER = 'CollectionListFilter'; public const CAPABILITY_COLLECTION_LIST_SORT = 'CollectionListSort'; public const CAPABILITY_COLLECTION_EXTANT = 'CollectionExtant'; public const CAPABILITY_COLLECTION_FETCH = 'CollectionFetch'; public const CAPABILITY_ENTITY_LIST = 'EntityList'; public const CAPABILITY_ENTITY_LIST_FILTER = 'EntityListFilter'; public const CAPABILITY_ENTITY_LIST_SORT = 'EntityListSort'; public const CAPABILITY_ENTITY_LIST_RANGE = 'EntityListRange'; public const CAPABILITY_ENTITY_DELTA = 'EntityDelta'; public const CAPABILITY_ENTITY_EXTANT = 'EntityExtant'; public const CAPABILITY_ENTITY_FETCH = 'EntityFetch'; public const JSON_TYPE = 'people.service'; public const JSON_PROPERTY_TYPE = '@type'; public const JSON_PROPERTY_PROVIDER = 'provider'; public const JSON_PROPERTY_ID = 'id'; public const JSON_PROPERTY_LABEL = 'label'; public const JSON_PROPERTY_CAPABILITIES = 'capabilities'; public const JSON_PROPERTY_ENABLED = 'enabled'; /** * Confirms if specific capability is supported * * @since 2025.05.01 * * @param string $value required ability e.g. 'EntityList' * * @return bool */ public function capable(string $value): bool; /** * Lists all supported capabilities * * @since 2025.05.01 * * @return array */ public function capabilities(): array; /** * Unique identifier of the provider this service belongs to * * @since 2025.05.01 */ public function in(): string; /** * Unique arbitrary text string identifying this service (e.g. 1 or service1 or anything else) * * @since 2025.05.01 */ public function id(): string|int; /** * Gets the localized human friendly name of this service (e.g. ACME Company Mail Service) * * @since 2025.05.01 */ public function getLabel(): string; /** * Gets the active status of this service * * @since 2025.05.01 */ public function getEnabled(): bool; /** * List of accessible collection * * @since 2025.05.01 * * @return array */ public function collectionList(?IFilter $filter = null, ?ISort $sort = null): array; /** * Fresh filter for collection list * * @since 2025.05.01 * * @return IFilter */ public function collectionListFilter(): IFilter; /** * Fresh sort for collection list * * @since 2025.05.01 * * @return ISort */ public function collectionListSort(): ISort; /** * Fetches details about a specific collection * * @since 2025.05.01 * * @param string|int $id collection identifier */ public function collectionExtant(string|int $identifier): bool; /** * Fetches details about a specific collection * * @since 2025.05.01 * * @param string|int $identifier collection identifier */ public function collectionFetch(string|int $identifier): ?ICollectionBase; /** * Lists all entities in a specific collection * * @since 2025.05.01 * * @param string|int $collection collection identifier * * @return array */ public function entityList(string|int $collection, ?IFilter $filter = null, ?ISort $sort = null, ?IRange $range = null, ?array $elements = null): array; /** * Fresh filter for entity list * * @since 2025.05.01 * * @return Filter */ public function entityListFilter(): IFilter; /** * Fresh sort for entity list * * @since 2025.05.01 * * @return ISort */ public function entityListSort(): ISort; /** * Fresh range for entity list * * @since 2025.05.01 * * @param RangeType $type range type * * @return IRange */ public function entityListRange(RangeType $type): IRange; /** * Lists of all changes from a specific token * * @since 2025.05.01 * * @param string|int $collection collection identifier * @param string $signature token signature * @param string $detail detail level ids | meta | full * * @return array * * [ * 'added' => array, * 'updated' => array, * 'deleted' => array, * 'signature' => string * ] * */ public function entityDelta(string|int $collection, string $signature, string $detail = 'ids'): array; /** * Confirms if specific entity exists in a collection * * @since 2025.05.01 * * @param string|int $collection collection identifier * @param string|int ...$identifiers list of entity identifiers * * @return array */ public function entityExtant(string|int $collection, string|int ...$identifiers): array; /** * Fetches details about a specific entities in a collection * * @since 2025.05.01 * * @param string|int $collection collection identifier * @param string|int ...$identifiers entity identifier * * @return array */ public function entityFetch(string|int $collection, string|int ...$identifiers): array; }