Initial Version
This commit is contained in:
24
shared/lib/Chrono/Collection/CollectionContent.php
Normal file
24
shared/lib/Chrono/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\Chrono\Collection;
|
||||
|
||||
use JsonSerializable;
|
||||
|
||||
enum CollectionContent: string implements JsonSerializable {
|
||||
|
||||
case Event = 'event';
|
||||
case Task = 'task';
|
||||
case Journal = 'journal';
|
||||
|
||||
public function jsonSerialize(): string {
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
}
|
||||
26
shared/lib/Chrono/Collection/CollectionPermissions.php
Normal file
26
shared/lib/Chrono/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\Chrono\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;
|
||||
}
|
||||
|
||||
}
|
||||
23
shared/lib/Chrono/Collection/CollectionRoles.php
Normal file
23
shared/lib/Chrono/Collection/CollectionRoles.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Chrono\Collection;
|
||||
|
||||
use JsonSerializable;
|
||||
|
||||
enum CollectionRoles: string implements JsonSerializable {
|
||||
|
||||
case System = 'system';
|
||||
case Individual = 'individual';
|
||||
|
||||
public function jsonSerialize(): string {
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
}
|
||||
160
shared/lib/Chrono/Collection/ICollectionBase.php
Normal file
160
shared/lib/Chrono/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\Chrono\Collection;
|
||||
|
||||
use DateTimeImmutable;
|
||||
use JsonSerializable;
|
||||
|
||||
interface ICollectionBase extends JsonSerializable {
|
||||
|
||||
public const JSON_TYPE = 'chrono.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 collection (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 permissions 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 Calendar)
|
||||
*
|
||||
* @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/Chrono/Collection/ICollectionMutable.php
Normal file
58
shared/lib/Chrono/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\Chrono\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 Calendar)
|
||||
*
|
||||
* @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;
|
||||
|
||||
}
|
||||
25
shared/lib/Chrono/Entity/EntityPermissions.php
Normal file
25
shared/lib/Chrono/Entity/EntityPermissions.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Chrono\Entity;
|
||||
|
||||
use JsonSerializable;
|
||||
|
||||
enum EntityPermissions: string implements JsonSerializable {
|
||||
|
||||
case View = 'view';
|
||||
case Modify = 'modify';
|
||||
case Delete = 'delete';
|
||||
case Share = 'share';
|
||||
|
||||
public function jsonSerialize(): string {
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
}
|
||||
93
shared/lib/Chrono/Entity/IEntityBase.php
Normal file
93
shared/lib/Chrono/Entity/IEntityBase.php
Normal file
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Chrono\Entity;
|
||||
|
||||
use DateTimeImmutable;
|
||||
|
||||
interface IEntityBase extends \JsonSerializable {
|
||||
|
||||
public const JSON_TYPE = 'chrono.entity';
|
||||
public const JSON_PROPERTY_TYPE = '@type';
|
||||
public const JSON_PROPERTY_IN = 'in';
|
||||
public const JSON_PROPERTY_ID = 'id';
|
||||
public const JSON_PROPERTY_DATA = 'data';
|
||||
public const JSON_PROPERTY_CREATED = 'created';
|
||||
public const JSON_PROPERTY_MODIFIED = 'modified';
|
||||
public const JSON_PROPERTY_SIGNATURE = 'signature';
|
||||
|
||||
/**
|
||||
* Unique arbitrary text string identifying the collection this entity belongs to (e.g. 1 or Collection1 or anything else)
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function in(): string|int;
|
||||
|
||||
/**
|
||||
* Unique arbitrary text string identifying this entity (e.g. 1 or Entity or anything else)
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function id(): string|int;
|
||||
|
||||
/**
|
||||
* Gets the creation date of this entity
|
||||
*/
|
||||
public function created(): ?DateTimeImmutable;
|
||||
|
||||
/**
|
||||
* Gets the modification date of this entity
|
||||
*/
|
||||
public function modified(): ?DateTimeImmutable;
|
||||
|
||||
/**
|
||||
* Gets the signature of this entity
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function signature(): ?string;
|
||||
|
||||
/**
|
||||
* Gets the priority of this entity
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function getPriority(): ?int;
|
||||
|
||||
/**
|
||||
* Gets the visibility of this entity
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function getVisibility(): ?bool;
|
||||
|
||||
/**
|
||||
* Gets the color of this entity
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function getColor(): ?string;
|
||||
|
||||
/**
|
||||
* Gets the object data (event, task, or journal).
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function getDataObject(): object|null;
|
||||
|
||||
/**
|
||||
* Gets the raw data as an associative array or JSON string.
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return array|string|null
|
||||
*/
|
||||
public function getDataJson(): array|string|null;
|
||||
|
||||
}
|
||||
51
shared/lib/Chrono/Entity/IEntityMutable.php
Normal file
51
shared/lib/Chrono/Entity/IEntityMutable.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Chrono\Entity;
|
||||
|
||||
use KTXF\Json\JsonDeserializable;
|
||||
|
||||
interface IEntityMutable extends IEntityBase, JsonDeserializable {
|
||||
|
||||
/**
|
||||
* Sets the priority of this entity
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function setPriority(?int $value): static;
|
||||
|
||||
/**
|
||||
* Sets the visibility of this entity
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function setVisibility(?bool $value): static;
|
||||
|
||||
/**
|
||||
* Sets the color of this entity
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function setColor(?string $value): static;
|
||||
|
||||
/**
|
||||
* Sets the object as a class instance.
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function setDataObject(object $value): static;
|
||||
|
||||
/**
|
||||
* Sets the object data from a json string
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function setDataJson(array|string $value): static;
|
||||
|
||||
}
|
||||
15
shared/lib/Chrono/Event/EventAvailabilityTypes.php
Normal file
15
shared/lib/Chrono/Event/EventAvailabilityTypes.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Chrono\Event;
|
||||
|
||||
enum EventAvailabilityTypes: string {
|
||||
case Free = 'free';
|
||||
case Busy = 'busy';
|
||||
}
|
||||
50
shared/lib/Chrono/Event/EventCommonObject.php
Normal file
50
shared/lib/Chrono/Event/EventCommonObject.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Chrono\Event;
|
||||
|
||||
use DateInterval;
|
||||
use DateTime;
|
||||
use DateTimeImmutable;
|
||||
use DateTimeZone;
|
||||
use KTXF\Json\JsonSerializableObject;
|
||||
|
||||
class EventCommonObject extends JsonSerializableObject {
|
||||
|
||||
public int|null $sequence = null;
|
||||
public DateTimeZone|null $timeZone = null;
|
||||
public DateTime|DateTimeImmutable|null $startsOn = null;
|
||||
public DateTimeZone|null $startsTZ = null;
|
||||
public DateTime|DateTimeImmutable|null $endsOn = null;
|
||||
public DateTimeZone|null $endsTZ = null;
|
||||
public DateInterval|null $duration = null;
|
||||
public bool|null $timeless = false;
|
||||
public string|null $label = null;
|
||||
public string|null $description = null;
|
||||
public EventLocationPhysicalCollection $locationsPhysical;
|
||||
public EventLocationVirtualCollection $locationsVirtual;
|
||||
public EventAvailabilityTypes|null $availability = null;
|
||||
public EventSensitivityTypes|null $sensitivity = null;
|
||||
public int|null $priority = null;
|
||||
public string|null $color = null;
|
||||
public EventTagCollection $tags;
|
||||
public EventOrganizerObject $organizer;
|
||||
public EventParticipantCollection $participants;
|
||||
public EventNotificationCollection $notifications;
|
||||
|
||||
public function __construct() {
|
||||
$this->participants = new EventParticipantCollection();
|
||||
$this->locationsPhysical = new EventLocationPhysicalCollection();
|
||||
$this->locationsVirtual = new EventLocationVirtualCollection();
|
||||
$this->notifications = new EventNotificationCollection();
|
||||
$this->organizer = new EventOrganizerObject();
|
||||
$this->tags = new EventTagCollection();
|
||||
}
|
||||
|
||||
}
|
||||
20
shared/lib/Chrono/Event/EventLocationPhysicalCollection.php
Normal file
20
shared/lib/Chrono/Event/EventLocationPhysicalCollection.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Chrono\Event;
|
||||
|
||||
use KTXF\Json\JsonSerializableCollection;
|
||||
|
||||
class EventLocationPhysicalCollection extends JsonSerializableCollection {
|
||||
|
||||
public function __construct(array $data = []) {
|
||||
parent::__construct($data, EventLocationPhysicalObject::class, 'string');
|
||||
}
|
||||
|
||||
}
|
||||
22
shared/lib/Chrono/Event/EventLocationPhysicalObject.php
Normal file
22
shared/lib/Chrono/Event/EventLocationPhysicalObject.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Chrono\Event;
|
||||
|
||||
use KTXF\Json\JsonSerializableObject;
|
||||
|
||||
class EventLocationPhysicalObject extends JsonSerializableObject {
|
||||
|
||||
public string|null $identifier = null;
|
||||
public string|null $label = null;
|
||||
public string|null $description = null;
|
||||
public string|null $relation = null; // e.g. start, end of event
|
||||
public string|null $timeZone = null;
|
||||
|
||||
}
|
||||
20
shared/lib/Chrono/Event/EventLocationVirtualCollection.php
Normal file
20
shared/lib/Chrono/Event/EventLocationVirtualCollection.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Chrono\Event;
|
||||
|
||||
use KTXF\Json\JsonSerializableCollection;
|
||||
|
||||
class EventLocationVirtualCollection extends JsonSerializableCollection {
|
||||
|
||||
public function __construct(array $data = []) {
|
||||
parent::__construct($data, EventLocationVirtualObject::class, 'string');
|
||||
}
|
||||
|
||||
}
|
||||
22
shared/lib/Chrono/Event/EventLocationVirtualObject.php
Normal file
22
shared/lib/Chrono/Event/EventLocationVirtualObject.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Chrono\Event;
|
||||
|
||||
use KTXF\Json\JsonSerializableObject;
|
||||
|
||||
class EventLocationVirtualObject extends JsonSerializableObject {
|
||||
|
||||
public string|null $identifier = null;
|
||||
public string|null $label = null;
|
||||
public string|null $description = null;
|
||||
public string|null $relation = null;
|
||||
public string|null $location = null;
|
||||
|
||||
}
|
||||
20
shared/lib/Chrono/Event/EventMutationCollection.php
Normal file
20
shared/lib/Chrono/Event/EventMutationCollection.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Chrono\Event;
|
||||
|
||||
use KTXF\Json\JsonSerializableCollection;
|
||||
|
||||
class EventMutationCollection extends JsonSerializableCollection {
|
||||
|
||||
public function __construct(array $data = []) {
|
||||
parent::__construct($data, EventMutationObject::class, 'string');
|
||||
}
|
||||
|
||||
}
|
||||
21
shared/lib/Chrono/Event/EventMutationObject.php
Normal file
21
shared/lib/Chrono/Event/EventMutationObject.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Chrono\Event;
|
||||
|
||||
use DateTime;
|
||||
use DateTimeImmutable;
|
||||
|
||||
class EventMutationObject extends EventCommonObject {
|
||||
|
||||
public DateTime|DateTimeImmutable|null $mutationId = null;
|
||||
public string|null $mutationTz = null;
|
||||
public bool|null $mutationExclusion = null;
|
||||
|
||||
}
|
||||
15
shared/lib/Chrono/Event/EventNotificationAnchorTypes.php
Normal file
15
shared/lib/Chrono/Event/EventNotificationAnchorTypes.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Chrono\Event;
|
||||
|
||||
enum EventNotificationAnchorTypes: string {
|
||||
case Start = 'start';
|
||||
case End = 'end';
|
||||
}
|
||||
20
shared/lib/Chrono/Event/EventNotificationCollection.php
Normal file
20
shared/lib/Chrono/Event/EventNotificationCollection.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Chrono\Event;
|
||||
|
||||
use KTXF\Json\JsonSerializableCollection;
|
||||
|
||||
class EventNotificationCollection extends JsonSerializableCollection {
|
||||
|
||||
public function __construct(array $data = []) {
|
||||
parent::__construct($data, EventNotificationObject::class, 'string');
|
||||
}
|
||||
|
||||
}
|
||||
24
shared/lib/Chrono/Event/EventNotificationObject.php
Normal file
24
shared/lib/Chrono/Event/EventNotificationObject.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\Chrono\Event;
|
||||
|
||||
use DateInterval;
|
||||
use DateTime;
|
||||
use DateTimeImmutable;
|
||||
use KTXF\Json\JsonSerializableObject;
|
||||
|
||||
class EventNotificationObject extends JsonSerializableObject {
|
||||
public string|null $identifier = null;
|
||||
public EventNotificationTypes|null $Type = null;
|
||||
public EventNotificationPatterns|null $Pattern = null;
|
||||
public DateTime|DateTimeImmutable|null $When = null;
|
||||
public EventNotificationAnchorTypes|null $Anchor = null;
|
||||
public DateInterval|null $Offset = null;
|
||||
}
|
||||
16
shared/lib/Chrono/Event/EventNotificationPatterns.php
Normal file
16
shared/lib/Chrono/Event/EventNotificationPatterns.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Chrono\Event;
|
||||
|
||||
enum EventNotificationPatterns: string {
|
||||
case Absolute = 'absolute';
|
||||
case Relative = 'relative';
|
||||
case Unknown = 'unknown';
|
||||
}
|
||||
16
shared/lib/Chrono/Event/EventNotificationTypes.php
Normal file
16
shared/lib/Chrono/Event/EventNotificationTypes.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Chrono\Event;
|
||||
|
||||
enum EventNotificationTypes: string {
|
||||
case Visual = 'visual';
|
||||
case Audible = 'audible';
|
||||
case Email = 'email';
|
||||
}
|
||||
31
shared/lib/Chrono/Event/EventObject.php
Normal file
31
shared/lib/Chrono/Event/EventObject.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Chrono\Event;
|
||||
|
||||
use DateTimeInterface;
|
||||
|
||||
class EventObject extends EventCommonObject {
|
||||
|
||||
// Meta Information
|
||||
public string $type = 'event';
|
||||
public int $version = 1;
|
||||
public string|null $urid = null;
|
||||
public ?DateTimeInterface $created = null;
|
||||
public ?DateTimeInterface $modified = null;
|
||||
|
||||
public EventOccurrenceObject|null $pattern = null;
|
||||
public EventMutationCollection $mutations;
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
$this->mutations = new EventMutationCollection();
|
||||
}
|
||||
|
||||
}
|
||||
36
shared/lib/Chrono/Event/EventOccurrenceObject.php
Normal file
36
shared/lib/Chrono/Event/EventOccurrenceObject.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Chrono\Event;
|
||||
|
||||
use DateTime;
|
||||
use DateTimeImmutable;
|
||||
use KTXF\Json\JsonSerializableObject;
|
||||
|
||||
class EventOccurrenceObject extends JsonSerializableObject {
|
||||
public EventOccurrencePatternTypes|null $pattern = null; // Pattern - Absolute / Relative
|
||||
public EventOccurrencePrecisionTypes|null $precision = null; // Time Interval
|
||||
public int|null $interval = null; // Time Interval - Every 2 Days / Every 4 Weeks / Every 1 Year
|
||||
public int|null $iterations = null; // Number of recurrence
|
||||
public DateTime|DateTimeImmutable|null $concludes = null; // Date to stop recurrence
|
||||
public String|null $scale = null; // calendar system in which this recurrence rule operates
|
||||
public array $onDayOfWeek = [];
|
||||
public array $onDayOfMonth = [];
|
||||
public array $onDayOfYear = [];
|
||||
public array $onWeekOfMonth = [];
|
||||
public array $onWeekOfYear = [];
|
||||
public array $onMonthOfYear = [];
|
||||
public array $onHour = [];
|
||||
public array $onMinute = [];
|
||||
public array $onSecond = [];
|
||||
public array $onPosition = [];
|
||||
|
||||
public function __construct() {
|
||||
}
|
||||
}
|
||||
15
shared/lib/Chrono/Event/EventOccurrencePatternTypes.php
Normal file
15
shared/lib/Chrono/Event/EventOccurrencePatternTypes.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Chrono\Event;
|
||||
|
||||
enum EventOccurrencePatternTypes: string {
|
||||
case Absolute = 'absolute';
|
||||
case Relative = 'relative';
|
||||
}
|
||||
20
shared/lib/Chrono/Event/EventOccurrencePrecisionTypes.php
Normal file
20
shared/lib/Chrono/Event/EventOccurrencePrecisionTypes.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Chrono\Event;
|
||||
|
||||
enum EventOccurrencePrecisionTypes: string {
|
||||
case Yearly = 'yearly';
|
||||
case Monthly = 'monthly';
|
||||
case Weekly = 'weekly';
|
||||
case Daily = 'daily';
|
||||
case Hourly = 'hourly';
|
||||
case Minutely = 'minutely';
|
||||
case Secondly = 'secondly';
|
||||
}
|
||||
20
shared/lib/Chrono/Event/EventOrganizerObject.php
Normal file
20
shared/lib/Chrono/Event/EventOrganizerObject.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Chrono\Event;
|
||||
|
||||
use KTXF\Json\JsonSerializableObject;
|
||||
|
||||
class EventOrganizerObject extends JsonSerializableObject {
|
||||
|
||||
public EventParticipantRealm|null $realm = null; // E - external, I - internal
|
||||
public string|null $address = null;
|
||||
public string|null $name = null;
|
||||
|
||||
}
|
||||
20
shared/lib/Chrono/Event/EventParticipantCollection.php
Normal file
20
shared/lib/Chrono/Event/EventParticipantCollection.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Chrono\Event;
|
||||
|
||||
use KTXF\Json\JsonSerializableCollection;
|
||||
|
||||
class EventParticipantCollection extends JsonSerializableCollection {
|
||||
|
||||
public function __construct(array $data = []) {
|
||||
parent::__construct($data, EventParticipantObject::class, 'string');
|
||||
}
|
||||
|
||||
}
|
||||
31
shared/lib/Chrono/Event/EventParticipantObject.php
Normal file
31
shared/lib/Chrono/Event/EventParticipantObject.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Chrono\Event;
|
||||
|
||||
use KTXF\Json\JsonSerializableObject;
|
||||
|
||||
class EventParticipantObject extends JsonSerializableObject {
|
||||
|
||||
public string|null $identifier = null;
|
||||
public EventParticipantRealm|null $realm = null; // E - external, I - internal
|
||||
public string|null $name = null;
|
||||
public string|null $description = null;
|
||||
public string|null $language = null;
|
||||
public string|null $address = null;
|
||||
public EventParticipantTypes|null $type = null;
|
||||
public EventParticipantStatusTypes|null $status = null;
|
||||
public string|null $comment = null;
|
||||
public EventParticipantRoleCollection $roles;
|
||||
|
||||
public function __construct() {
|
||||
$this->roles = new EventParticipantRoleCollection();
|
||||
}
|
||||
|
||||
}
|
||||
15
shared/lib/Chrono/Event/EventParticipantRealm.php
Normal file
15
shared/lib/Chrono/Event/EventParticipantRealm.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Chrono\Event;
|
||||
|
||||
enum EventParticipantRealm: string {
|
||||
case Internal = 'I';
|
||||
case External = 'E';
|
||||
}
|
||||
20
shared/lib/Chrono/Event/EventParticipantRoleCollection.php
Normal file
20
shared/lib/Chrono/Event/EventParticipantRoleCollection.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Chrono\Event;
|
||||
|
||||
use KTXF\Json\JsonSerializableCollection;
|
||||
|
||||
class EventParticipantRoleCollection extends JsonSerializableCollection {
|
||||
|
||||
public function __construct(array $data = []) {
|
||||
parent::__construct($data, EventParticipantRoleTypes::class);
|
||||
}
|
||||
|
||||
}
|
||||
19
shared/lib/Chrono/Event/EventParticipantRoleTypes.php
Normal file
19
shared/lib/Chrono/Event/EventParticipantRoleTypes.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Chrono\Event;
|
||||
|
||||
enum EventParticipantRoleTypes: string {
|
||||
case Owner = 'owner';
|
||||
case Chair = 'chair';
|
||||
case Attendee = 'attendee';
|
||||
case Optional = 'optional';
|
||||
case Informational = 'informational';
|
||||
case Contact = 'contact';
|
||||
}
|
||||
18
shared/lib/Chrono/Event/EventParticipantStatusTypes.php
Normal file
18
shared/lib/Chrono/Event/EventParticipantStatusTypes.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Chrono\Event;
|
||||
|
||||
enum EventParticipantStatusTypes: string {
|
||||
case None = 'none';
|
||||
case Accepted = 'accepted';
|
||||
case Declined = 'declined';
|
||||
case Tentative = 'tentative';
|
||||
case Delegated = 'delegated';
|
||||
}
|
||||
18
shared/lib/Chrono/Event/EventParticipantTypes.php
Normal file
18
shared/lib/Chrono/Event/EventParticipantTypes.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Chrono\Event;
|
||||
|
||||
enum EventParticipantTypes: string {
|
||||
case Unknown = 'unknown';
|
||||
case Individual = 'individual';
|
||||
case Group = 'group';
|
||||
case Resource = 'resource';
|
||||
case Location = 'location';
|
||||
}
|
||||
16
shared/lib/Chrono/Event/EventSensitivityTypes.php
Normal file
16
shared/lib/Chrono/Event/EventSensitivityTypes.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Chrono\Event;
|
||||
|
||||
enum EventSensitivityTypes: string {
|
||||
case Public = 'public';
|
||||
case Private = 'private';
|
||||
case Secret = 'secret';
|
||||
}
|
||||
20
shared/lib/Chrono/Event/EventTagCollection.php
Normal file
20
shared/lib/Chrono/Event/EventTagCollection.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Chrono\Event;
|
||||
|
||||
use KTXF\Json\JsonSerializableCollection;
|
||||
|
||||
class EventTagCollection extends JsonSerializableCollection {
|
||||
|
||||
public function __construct(array $data = []) {
|
||||
parent::__construct($data, 'string');
|
||||
}
|
||||
|
||||
}
|
||||
96
shared/lib/Chrono/Provider/IProviderBase.php
Normal file
96
shared/lib/Chrono/Provider/IProviderBase.php
Normal file
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Chrono\Provider;
|
||||
|
||||
use JsonSerializable;
|
||||
use KTXF\Chrono\Service\IServiceBase;
|
||||
|
||||
interface IProviderBase extends JsonSerializable {
|
||||
|
||||
public const CAPABILITY_SERVICE_LIST = 'ServiceList';
|
||||
public const CAPABILITY_SERVICE_FETCH = 'ServiceFetch';
|
||||
public const CAPABILITY_SERVICE_EXTANT = 'ServiceExtant';
|
||||
|
||||
public const JSON_TYPE = 'chrono.provider';
|
||||
public const JSON_PROPERTY_TYPE = '@type';
|
||||
public const JSON_PROPERTY_ID = 'id';
|
||||
public const JSON_PROPERTY_LABEL = 'label';
|
||||
public const JSON_PROPERTY_CAPABILITIES = 'capabilities';
|
||||
|
||||
/**
|
||||
* Confirms if specific capability is supported (e.g. 'ServiceList')
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function capable(string $value): bool;
|
||||
|
||||
/**
|
||||
* Lists all supported capabilities
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return array<string,bool>
|
||||
*/
|
||||
public function capabilities(): array;
|
||||
|
||||
/**
|
||||
* An arbitrary unique text string identifying this provider (e.g. UUID or 'system' or anything else)
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function id(): string;
|
||||
|
||||
/**
|
||||
* The localized human friendly name of this provider (e.g. System Calendar Provider)
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function label(): string;
|
||||
|
||||
/**
|
||||
* Retrieve collection of services for a specific user
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param string $tenantId tenant identifier
|
||||
* @param string $userId user identifier
|
||||
* @param array $filter filter criteria
|
||||
*
|
||||
* @return array<string,IServiceBase> collection of service objects
|
||||
*/
|
||||
public function serviceList(string $tenantId, string $userId, array $filter): array;
|
||||
|
||||
/**
|
||||
* Determine if any services are configured for a specific user
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param string $tenantId tenant identifier
|
||||
* @param string $userId user identifier
|
||||
* @param int|string ...$identifiers variadic collection of service identifiers
|
||||
*
|
||||
* @return array<string,bool> collection of service identifiers with boolean values indicating if the service is available
|
||||
*/
|
||||
public function serviceExtant(string $tenantId, string $userId, int|string ...$identifiers): array;
|
||||
|
||||
/**
|
||||
* Retrieve a service with a specific identifier
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param string $tenantId tenant identifier
|
||||
* @param string $userId user identifier
|
||||
* @param string|int $identifier service identifier
|
||||
*
|
||||
* @return IServiceBase|null returns service object or null if non found
|
||||
*/
|
||||
public function serviceFetch(string $tenantId, string $userId, string|int $identifier): ?IServiceBase;
|
||||
|
||||
}
|
||||
50
shared/lib/Chrono/Provider/IProviderServiceMutate.php
Normal file
50
shared/lib/Chrono/Provider/IProviderServiceMutate.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Chrono\Provider;
|
||||
|
||||
use KTXF\Json\JsonDeserializable;
|
||||
use KTXF\Chrono\Service\IServiceBase;
|
||||
|
||||
interface IProviderServiceMutate extends JsonDeserializable {
|
||||
|
||||
public const CAPABILITY_SERVICE_FRESH = 'ServiceFresh';
|
||||
public const CAPABILITY_SERVICE_CREATE = 'ServiceCreate';
|
||||
public const CAPABILITY_SERVICE_UPDATE = 'ServiceUpdate';
|
||||
public const CAPABILITY_SERVICE_DESTROY = 'ServiceDestroy';
|
||||
|
||||
/**
|
||||
* construct and new blank service instance
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function serviceFresh(string $uid = ''): IServiceBase;
|
||||
|
||||
/**
|
||||
* create a service configuration for a specific user
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function serviceCreate(string $uid, IServiceBase $service): string;
|
||||
|
||||
/**
|
||||
* modify a service configuration for a specific user
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function serviceModify(string $uid, IServiceBase $service): string;
|
||||
|
||||
/**
|
||||
* delete a service configuration for a specific user
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function serviceDestroy(string $uid, IServiceBase $service): bool;
|
||||
|
||||
}
|
||||
197
shared/lib/Chrono/Service/IServiceBase.php
Normal file
197
shared/lib/Chrono/Service/IServiceBase.php
Normal file
@@ -0,0 +1,197 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Chrono\Service;
|
||||
|
||||
use JsonSerializable;
|
||||
use KTXF\Chrono\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 CAPABILITY_FILTER_ANY = '*';
|
||||
public const CAPABILITY_FILTER_ID = 'id';
|
||||
public const CAPABILITY_FILTER_URID = 'urid';
|
||||
public const CAPABILITY_FILTER_LABEL = 'label';
|
||||
public const CAPABILITY_FILTER_DESCRIPTION = 'description';
|
||||
|
||||
public const CAPABILITY_SORT_ID = 'id';
|
||||
public const CAPABILITY_SORT_URID = 'urid';
|
||||
public const CAPABILITY_SORT_LABEL = 'label';
|
||||
public const CAPABILITY_SORT_PRIORITY = 'priority';
|
||||
|
||||
public const CAPABILITY_RANGE_TALLY = 'tally';
|
||||
public const CAPABILITY_RANGE_TALLY_ABSOLUTE = 'absolute';
|
||||
public const CAPABILITY_RANGE_TALLY_RELATIVE = 'relative';
|
||||
public const CAPABILITY_RANGE_DATE = 'date';
|
||||
|
||||
public const JSON_TYPE = 'chrono.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<string,bool>
|
||||
*/
|
||||
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 Calendar Service)
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function getLabel(): string;
|
||||
|
||||
/**
|
||||
* Gets the active status of this service
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function getEnabled(): bool;
|
||||
|
||||
/**
|
||||
* Retrieve collection of collections for this service
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function collectionList(?IFilter $filter = null, ?ISort $sort = null): array;
|
||||
|
||||
/**
|
||||
* Retrieve filter object for collection list
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function collectionListFilter(): IFilter;
|
||||
|
||||
/**
|
||||
* Retrieve sort object for collection list
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function collectionListSort(): ISort;
|
||||
|
||||
/**
|
||||
* Determine if a collection exists
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function collectionExtant(string|int $identifier): bool;
|
||||
|
||||
/**
|
||||
* Retrieve a specific collection
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function collectionFetch(string|int $identifier): ?ICollectionBase;
|
||||
|
||||
/**
|
||||
* Retrieve collection of entities from a specific collection
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function entityList(string|int $collection, ?IFilter $filter = null, ?ISort $sort = null, ?IRange $range = null, ?array $elements = null): array;
|
||||
|
||||
/**
|
||||
* Retrieve filter object for entity list
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function entityListFilter(): IFilter;
|
||||
|
||||
/**
|
||||
* Retrieve sort object for entity list
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function entityListSort(): ISort;
|
||||
|
||||
/**
|
||||
* Retrieve range object for entity list
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function entityListRange(RangeType $type): IRange;
|
||||
|
||||
/**
|
||||
* Retrieve collection of entities that have changed since a given signature
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param string|int $collection collection identifier
|
||||
* @param string $signature signature to compare against
|
||||
* @param string $detail level of detail to return (ids, full, etc)
|
||||
*
|
||||
* @return array collection of entities or entity identifiers
|
||||
*/
|
||||
public function entityDelta(string|int $collection, string $signature, string $detail = 'ids'): array;
|
||||
|
||||
/**
|
||||
* Determine if entities exist in a specific collection
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function entityExtant(string|int $collection, string|int ...$identifiers): array;
|
||||
|
||||
/**
|
||||
* Retrieve specific entities from a specific collection
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function entityFetch(string|int $collection, string|int ...$identifiers): array;
|
||||
|
||||
}
|
||||
79
shared/lib/Chrono/Service/IServiceCollectionMutable.php
Normal file
79
shared/lib/Chrono/Service/IServiceCollectionMutable.php
Normal file
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Chrono\Service;
|
||||
|
||||
use KTXF\Chrono\Collection\ICollectionBase;
|
||||
use KTXF\Chrono\Collection\ICollectionMutable;
|
||||
|
||||
interface IServiceCollectionMutable extends IServiceBase {
|
||||
|
||||
public const CAPABILITY_COLLECTION_CREATE = 'CollectionCreate';
|
||||
public const CAPABILITY_COLLECTION_MODIFY = 'CollectionModify';
|
||||
public const CAPABILITY_COLLECTION_DESTROY = 'CollectionDestroy';
|
||||
public const CAPABILITY_COLLECTION_MOVE = 'CollectionMove';
|
||||
|
||||
/**
|
||||
* Creates a new, empty collection object
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return ICollectionMutable
|
||||
*/
|
||||
public function collectionFresh(): ICollectionMutable;
|
||||
|
||||
/**
|
||||
* Creates a new collection at the specified location
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param string $location The parent collection to create this collection in, or empty string for root
|
||||
* @param ICollectionMutable $collection The collection to create
|
||||
* @param array $options Additional options for the collection creation
|
||||
*
|
||||
* @return ICollectionBase
|
||||
*
|
||||
* @throws \KTXF\Resource\Exceptions\InvalidArgumentException
|
||||
* @throws \KTXF\Resource\Exceptions\UnsupportedException
|
||||
* @throws \KTXF\Resource\Exceptions\UnauthorizedException
|
||||
*/
|
||||
public function collectionCreate(string|int $location, ICollectionMutable $collection, array $options): ICollectionBase;
|
||||
|
||||
/**
|
||||
* Modifies an existing collection
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param string $identifier The ID of the collection to modify
|
||||
* @param ICollectionMutable $collection The collection with modifications
|
||||
*
|
||||
* @return ICollectionBase
|
||||
*
|
||||
* @throws \KTXF\Resource\Exceptions\InvalidArgumentException
|
||||
* @throws \KTXF\Resource\Exceptions\UnsupportedException
|
||||
* @throws \KTXF\Resource\Exceptions\UnauthorizedException
|
||||
*/
|
||||
public function collectionModify(string|int $identifier, ICollectionMutable $collection): ICollectionBase;
|
||||
|
||||
/**
|
||||
* Destroys an existing collection
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param string $identifier The ID of the collection to destroy
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @throws \KTXF\Resource\Exceptions\InvalidArgumentException
|
||||
* @throws \KTXF\Resource\Exceptions\UnsupportedException
|
||||
* @throws \KTXF\Resource\Exceptions\UnauthorizedException
|
||||
*/
|
||||
public function collectionDestroy(string|int $identifier): bool;
|
||||
|
||||
}
|
||||
81
shared/lib/Chrono/Service/IServiceEntityMutable.php
Normal file
81
shared/lib/Chrono/Service/IServiceEntityMutable.php
Normal file
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Chrono\Service;
|
||||
|
||||
use KTXF\Chrono\Entity\IEntityMutable;
|
||||
|
||||
interface IServiceEntityMutable extends IServiceBase {
|
||||
|
||||
public const CAPABILITY_ENTITY_CREATE = 'EntityCreate';
|
||||
public const CAPABILITY_ENTITY_MODIFY = 'EntityModify';
|
||||
public const CAPABILITY_ENTITY_DESTROY = 'EntityDestroy';
|
||||
public const CAPABILITY_ENTITY_COPY = 'EntityCopy';
|
||||
public const CAPABILITY_ENTITY_MOVE = 'EntityMove';
|
||||
|
||||
/**
|
||||
* Creates a fresh entity of the specified type
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return IEntityMutable
|
||||
*/
|
||||
public function entityFresh(): IEntityMutable;
|
||||
|
||||
/**
|
||||
* Creates a new entity in the specified collection
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param string $collection The collection to create this entity in
|
||||
* @param IEntityMutable $entity The entity to create
|
||||
* @param array $options Additional options for the entity creation
|
||||
*
|
||||
* @return IEntityMutable
|
||||
*
|
||||
* @throws \KTXF\Resource\Exceptions\InvalidArgumentException
|
||||
* @throws \KTXF\Resource\Exceptions\UnsupportedException
|
||||
* @throws \KTXF\Resource\Exceptions\UnauthorizedException
|
||||
*/
|
||||
public function entityCreate(string|int $collection, IEntityMutable $entity, array $options): IEntityMutable;
|
||||
|
||||
/**
|
||||
* Modifies an existing entity in the specified collection
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param string $collection The collection containing the entity to modify
|
||||
* @param string $identifier The ID of the entity to modify
|
||||
* @param IEntityMutable $entity The entity with modifications
|
||||
*
|
||||
* @return IEntityMutable
|
||||
*
|
||||
* @throws \KTXF\Resource\Exceptions\InvalidArgumentException
|
||||
* @throws \KTXF\Resource\Exceptions\UnsupportedException
|
||||
* @throws \KTXF\Resource\Exceptions\UnauthorizedException
|
||||
*/
|
||||
public function entityModify(string|int $collection, string|int $identifier, IEntityMutable $entity): IEntityMutable;
|
||||
|
||||
/**
|
||||
* Destroys an existing entity in the specified collection
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param string $collection The collection containing the entity to destroy
|
||||
* @param string $identifier The ID of the entity to destroy
|
||||
*
|
||||
* @return IEntityMutable
|
||||
*
|
||||
* @throws \KTXF\Resource\Exceptions\InvalidArgumentException
|
||||
* @throws \KTXF\Resource\Exceptions\UnsupportedException
|
||||
* @throws \KTXF\Resource\Exceptions\UnauthorizedException
|
||||
*/
|
||||
public function entityDestroy(string|int $collection, string|int $identifier): IEntityMutable;
|
||||
|
||||
}
|
||||
30
shared/lib/Chrono/Service/IServiceMutable.php
Normal file
30
shared/lib/Chrono/Service/IServiceMutable.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Chrono\Service;
|
||||
|
||||
use KTXF\Json\JsonDeserializable;
|
||||
|
||||
interface IServiceMutable extends IServiceBase, JsonDeserializable {
|
||||
|
||||
/**
|
||||
* Sets the localized human friendly name of this service (e.g. ACME Company Calendar Service)
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function setLabel(string $value): self;
|
||||
|
||||
/**
|
||||
* Sets the active status of this service
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function setEnabled(bool $value): self;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user