Initial Version
This commit is contained in:
24
shared/lib/People/Collection/CollectionContent.php
Normal file
24
shared/lib/People/Collection/CollectionContent.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\People\Collection;
|
||||
|
||||
use JsonSerializable;
|
||||
|
||||
enum CollectionContent: string implements JsonSerializable {
|
||||
|
||||
case Individual = 'individual';
|
||||
case Organization = 'organization';
|
||||
case Group = 'group';
|
||||
|
||||
public function jsonSerialize(): string {
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
}
|
||||
26
shared/lib/People/Collection/CollectionPermissions.php
Normal file
26
shared/lib/People/Collection/CollectionPermissions.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\People\Collection;
|
||||
|
||||
use JsonSerializable;
|
||||
|
||||
enum CollectionPermissions: string implements JsonSerializable {
|
||||
|
||||
case View = 'view';
|
||||
case Create = 'create';
|
||||
case Modify = 'modify';
|
||||
case Destroy = 'destroy';
|
||||
case Share = 'share';
|
||||
|
||||
public function jsonSerialize(): string {
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
}
|
||||
24
shared/lib/People/Collection/CollectionRoles.php
Normal file
24
shared/lib/People/Collection/CollectionRoles.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\People\Collection;
|
||||
|
||||
use JsonSerializable;
|
||||
|
||||
enum CollectionRoles: string implements JsonSerializable {
|
||||
|
||||
case System = 'system';
|
||||
case Individual = 'individual';
|
||||
case Recent = 'recent';
|
||||
|
||||
public function jsonSerialize(): string {
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
}
|
||||
160
shared/lib/People/Collection/ICollectionBase.php
Normal file
160
shared/lib/People/Collection/ICollectionBase.php
Normal file
@@ -0,0 +1,160 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\People\Collection;
|
||||
|
||||
use DateTimeImmutable;
|
||||
use JsonSerializable;
|
||||
|
||||
interface ICollectionBase extends JsonSerializable {
|
||||
|
||||
public const JSON_TYPE = 'people.collection';
|
||||
public const JSON_PROPERTY_TYPE = '@type';
|
||||
public const JSON_PROPERTY_PROVIDER = 'provider';
|
||||
public const JSON_PROPERTY_SERVICE = 'service';
|
||||
public const JSON_PROPERTY_IN = 'in';
|
||||
public const JSON_PROPERTY_ID = 'id';
|
||||
public const JSON_PROPERTY_LABEL = 'label';
|
||||
public const JSON_PROPERTY_DESCRIPTION = 'description';
|
||||
public const JSON_PROPERTY_PRIORITY = 'priority';
|
||||
public const JSON_PROPERTY_VISIBILITY = 'visibility';
|
||||
public const JSON_PROPERTY_COLOR = 'color';
|
||||
public const JSON_PROPERTY_CREATED = 'created';
|
||||
public const JSON_PROPERTY_MODIFIED = 'modified';
|
||||
public const JSON_PROPERTY_ENABLED = 'enabled';
|
||||
public const JSON_PROPERTY_SIGNATURE = 'signature';
|
||||
public const JSON_PROPERTY_PERMISSIONS = 'permissions';
|
||||
public const JSON_PROPERTY_ROLES = 'roles';
|
||||
public const JSON_PROPERTY_CONTENTS = 'contents';
|
||||
|
||||
/**
|
||||
* Unique identifier of the service this collection belongs to
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function in(): string|int|null;
|
||||
|
||||
/**
|
||||
* Unique arbitrary text string identifying this service (e.g. 1 or collection1 or anything else)
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function id(): string|int;
|
||||
|
||||
/**
|
||||
* Gets the creation date of this collection
|
||||
*/
|
||||
public function created(): ?DateTimeImmutable;
|
||||
|
||||
/**
|
||||
* Gets the modification date of this collection
|
||||
*/
|
||||
public function modified(): ?DateTimeImmutable;
|
||||
|
||||
/**
|
||||
* Lists all supported attributes
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return array<string,array<string,bool>>
|
||||
*/
|
||||
public function attributes(): array;
|
||||
|
||||
/**
|
||||
* Gets the signature of this collection
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function signature(): ?string;
|
||||
|
||||
/**
|
||||
* Gets the role(s) of this collection
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function roles(): array;
|
||||
|
||||
/**
|
||||
* Checks if this collection supports the given role
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function role(CollectionRoles $value): bool;
|
||||
|
||||
/**
|
||||
* Gets the content types of this collection
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function contents(): array;
|
||||
|
||||
/**
|
||||
* Checks if this collection contains the given content type
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function contains(CollectionContent $value): bool;
|
||||
|
||||
/**
|
||||
* Gets the active status of this collection
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function getEnabled(): bool;
|
||||
|
||||
/**
|
||||
* Gets the active status of this collection
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function getPermissions(): array;
|
||||
|
||||
/**
|
||||
* Checks if this collection has the given permission
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function hasPermission(CollectionPermissions $permission): bool;
|
||||
|
||||
/**
|
||||
* Gets the human friendly name of this collection (e.g. Personal Contacts)
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function getLabel(): ?string;
|
||||
|
||||
/**
|
||||
* Gets the human friendly description of this collection
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function getDescription(): ?string;
|
||||
|
||||
/**
|
||||
* Gets the priority of this collection
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function getPriority(): ?int;
|
||||
|
||||
/**
|
||||
* Gets the visibility of this collection
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function getVisibility(): ?bool;
|
||||
|
||||
/**
|
||||
* Gets the color of this collection
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function getColor(): ?string;
|
||||
|
||||
}
|
||||
58
shared/lib/People/Collection/ICollectionMutable.php
Normal file
58
shared/lib/People/Collection/ICollectionMutable.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\People\Collection;
|
||||
|
||||
use KTXF\Json\JsonDeserializable;
|
||||
|
||||
interface ICollectionMutable extends ICollectionBase, JsonDeserializable {
|
||||
|
||||
/**
|
||||
* Sets the active status of this collection
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function setEnabled(bool $value): self;
|
||||
|
||||
/**
|
||||
* Sets the human friendly name of this collection (e.g. Personal Contacts)
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function setLabel(string $value): self;
|
||||
|
||||
/**
|
||||
* Sets the human friendly description of this collection
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function setDescription(?string $value): self;
|
||||
|
||||
/**
|
||||
* Sets the priority of this collection
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function setPriority(?int $value): self;
|
||||
|
||||
/**
|
||||
* Sets the visibility of this collection
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function setVisibility(?bool $value): self;
|
||||
|
||||
/**
|
||||
* Sets the color of this collection
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function setColor(?string $value): self;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user