refactor: chrono objects

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-06-28 17:51:23 -04:00
parent 319fcb6485
commit 8f61c4d2d5
38 changed files with 224 additions and 48 deletions
@@ -7,9 +7,12 @@ declare(strict_types=1);
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace KTXF\Chrono\Event;
namespace KTXF\Chrono\Entity;
use DateTimeInterface;
use KTXF\Chrono\Entity\Property\EventCommonObject;
use KTXF\Chrono\Entity\Property\EventMutationCollection;
use KTXF\Chrono\Entity\Property\EventOccurrenceObject;
class EventObject extends EventCommonObject {
@@ -0,0 +1,34 @@
<?php
declare(strict_types=1);
namespace KTXF\Chrono\Entity;
use DateTimeInterface;
use KTXF\Chrono\Entity\Property\AttachmentCollection;
use KTXF\Chrono\Entity\Property\JournalStatusTypes;
use KTXF\Chrono\Entity\Property\JournalVisibilityTypes;
use KTXF\Chrono\Entity\Property\TagCollection;
use KTXF\Json\JsonSerializableObject;
class JournalObject extends JsonSerializableObject {
public string $type = 'journal';
public int $version = 1;
public ?string $urid = null;
public ?DateTimeInterface $created = null;
public ?DateTimeInterface $modified = null;
public ?string $label = null;
public ?string $description = null;
public TagCollection $tags;
public ?string $content = null;
public ?DateTimeInterface $startsOn = null;
public ?DateTimeInterface $endsOn = null;
public ?JournalStatusTypes $status = null;
public ?JournalVisibilityTypes $visibility = null;
public AttachmentCollection $attachments;
public function __construct() {
$this->tags = new TagCollection();
$this->attachments = new AttachmentCollection();
}
}
@@ -0,0 +1,13 @@
<?php
declare(strict_types=1);
namespace KTXF\Chrono\Entity\Property;
use KTXF\Json\JsonSerializableCollection;
class AttachmentCollection extends JsonSerializableCollection {
public function __construct(array $data = []) {
parent::__construct($data, AttachmentObject::class, 'string');
}
}
@@ -0,0 +1,14 @@
<?php
declare(strict_types=1);
namespace KTXF\Chrono\Entity\Property;
use KTXF\Json\JsonSerializableObject;
class AttachmentObject extends JsonSerializableObject {
public ?string $uri = null;
public ?string $type = null;
public ?string $label = null;
public ?int $priority = null;
}
@@ -7,7 +7,7 @@ declare(strict_types=1);
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace KTXF\Chrono\Event;
namespace KTXF\Chrono\Entity\Property;
enum EventAvailabilityTypes: string {
case Free = 'free';
@@ -7,7 +7,7 @@ declare(strict_types=1);
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace KTXF\Chrono\Event;
namespace KTXF\Chrono\Entity\Property;
use DateInterval;
use DateTime;
@@ -33,7 +33,7 @@ class EventCommonObject extends JsonSerializableObject {
public EventSensitivityTypes|null $sensitivity = null;
public int|null $priority = null;
public string|null $color = null;
public EventTagCollection $tags;
public TagCollection $tags;
public EventOrganizerObject $organizer;
public EventParticipantCollection $participants;
public EventNotificationCollection $notifications;
@@ -44,7 +44,7 @@ class EventCommonObject extends JsonSerializableObject {
$this->locationsVirtual = new EventLocationVirtualCollection();
$this->notifications = new EventNotificationCollection();
$this->organizer = new EventOrganizerObject();
$this->tags = new EventTagCollection();
$this->tags = new TagCollection();
}
}
@@ -7,7 +7,7 @@ declare(strict_types=1);
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace KTXF\Chrono\Event;
namespace KTXF\Chrono\Entity\Property;
use KTXF\Json\JsonSerializableCollection;
@@ -7,7 +7,7 @@ declare(strict_types=1);
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace KTXF\Chrono\Event;
namespace KTXF\Chrono\Entity\Property;
use KTXF\Json\JsonSerializableObject;
@@ -7,7 +7,7 @@ declare(strict_types=1);
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace KTXF\Chrono\Event;
namespace KTXF\Chrono\Entity\Property;
use KTXF\Json\JsonSerializableCollection;
@@ -7,7 +7,7 @@ declare(strict_types=1);
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace KTXF\Chrono\Event;
namespace KTXF\Chrono\Entity\Property;
use KTXF\Json\JsonSerializableObject;
@@ -7,7 +7,7 @@ declare(strict_types=1);
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace KTXF\Chrono\Event;
namespace KTXF\Chrono\Entity\Property;
use KTXF\Json\JsonSerializableCollection;
@@ -7,7 +7,7 @@ declare(strict_types=1);
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace KTXF\Chrono\Event;
namespace KTXF\Chrono\Entity\Property;
use DateTime;
use DateTimeImmutable;
@@ -7,7 +7,7 @@ declare(strict_types=1);
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace KTXF\Chrono\Event;
namespace KTXF\Chrono\Entity\Property;
enum EventNotificationAnchorTypes: string {
case Start = 'start';
@@ -7,7 +7,7 @@ declare(strict_types=1);
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace KTXF\Chrono\Event;
namespace KTXF\Chrono\Entity\Property;
use KTXF\Json\JsonSerializableCollection;
@@ -7,7 +7,7 @@ declare(strict_types=1);
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace KTXF\Chrono\Event;
namespace KTXF\Chrono\Entity\Property;
use DateInterval;
use DateTime;
@@ -7,7 +7,7 @@ declare(strict_types=1);
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace KTXF\Chrono\Event;
namespace KTXF\Chrono\Entity\Property;
enum EventNotificationPatterns: string {
case Absolute = 'absolute';
@@ -7,7 +7,7 @@ declare(strict_types=1);
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace KTXF\Chrono\Event;
namespace KTXF\Chrono\Entity\Property;
enum EventNotificationTypes: string {
case Visual = 'visual';
@@ -7,7 +7,7 @@ declare(strict_types=1);
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace KTXF\Chrono\Event;
namespace KTXF\Chrono\Entity\Property;
use DateTime;
use DateTimeImmutable;
@@ -7,7 +7,7 @@ declare(strict_types=1);
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace KTXF\Chrono\Event;
namespace KTXF\Chrono\Entity\Property;
enum EventOccurrencePatternTypes: string {
case Absolute = 'absolute';
@@ -7,7 +7,7 @@ declare(strict_types=1);
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace KTXF\Chrono\Event;
namespace KTXF\Chrono\Entity\Property;
enum EventOccurrencePrecisionTypes: string {
case Yearly = 'yearly';
@@ -7,7 +7,7 @@ declare(strict_types=1);
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace KTXF\Chrono\Event;
namespace KTXF\Chrono\Entity\Property;
use KTXF\Json\JsonSerializableObject;
@@ -7,7 +7,7 @@ declare(strict_types=1);
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace KTXF\Chrono\Event;
namespace KTXF\Chrono\Entity\Property;
use KTXF\Json\JsonSerializableCollection;
@@ -7,7 +7,7 @@ declare(strict_types=1);
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace KTXF\Chrono\Event;
namespace KTXF\Chrono\Entity\Property;
use KTXF\Json\JsonSerializableObject;
@@ -7,7 +7,7 @@ declare(strict_types=1);
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace KTXF\Chrono\Event;
namespace KTXF\Chrono\Entity\Property;
enum EventParticipantRealm: string {
case Internal = 'I';
@@ -7,7 +7,7 @@ declare(strict_types=1);
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace KTXF\Chrono\Event;
namespace KTXF\Chrono\Entity\Property;
use KTXF\Json\JsonSerializableCollection;
@@ -7,7 +7,7 @@ declare(strict_types=1);
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace KTXF\Chrono\Event;
namespace KTXF\Chrono\Entity\Property;
enum EventParticipantRoleTypes: string {
case Owner = 'owner';
@@ -7,7 +7,7 @@ declare(strict_types=1);
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace KTXF\Chrono\Event;
namespace KTXF\Chrono\Entity\Property;
enum EventParticipantStatusTypes: string {
case None = 'none';
@@ -7,7 +7,7 @@ declare(strict_types=1);
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace KTXF\Chrono\Event;
namespace KTXF\Chrono\Entity\Property;
enum EventParticipantTypes: string {
case Unknown = 'unknown';
@@ -7,7 +7,7 @@ declare(strict_types=1);
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace KTXF\Chrono\Event;
namespace KTXF\Chrono\Entity\Property;
enum EventSensitivityTypes: string {
case Public = 'public';
@@ -0,0 +1,11 @@
<?php
declare(strict_types=1);
namespace KTXF\Chrono\Entity\Property;
enum JournalStatusTypes: string {
case Draft = 'draft';
case Final = 'final';
case Cancelled = 'cancelled';
}
@@ -0,0 +1,11 @@
<?php
declare(strict_types=1);
namespace KTXF\Chrono\Entity\Property;
enum JournalVisibilityTypes: string {
case Public = 'public';
case Private = 'private';
case Confidential = 'confidential';
}
@@ -0,0 +1,13 @@
<?php
declare(strict_types=1);
namespace KTXF\Chrono\Entity\Property;
use KTXF\Json\JsonSerializableCollection;
class TagCollection extends JsonSerializableCollection {
public function __construct(array $data = []) {
parent::__construct($data, 'string');
}
}
@@ -0,0 +1,18 @@
<?php
declare(strict_types=1);
namespace KTXF\Chrono\Entity\Property;
use DateTimeInterface;
use KTXF\Json\JsonSerializableObject;
class TaskRecurrenceObject extends JsonSerializableObject {
public ?string $frequency = null;
public ?int $interval = null;
public ?int $count = null;
public ?DateTimeInterface $until = null;
public array $byDay = [];
public array $byMonthDay = [];
public array $byMonth = [];
}
@@ -0,0 +1,12 @@
<?php
declare(strict_types=1);
namespace KTXF\Chrono\Entity\Property;
enum TaskStatusTypes: string {
case NeedsAction = 'needs-action';
case InProcess = 'in-process';
case Completed = 'completed';
case Cancelled = 'cancelled';
}
@@ -0,0 +1,13 @@
<?php
declare(strict_types=1);
namespace KTXF\Chrono\Entity\Property;
use KTXF\Json\JsonSerializableCollection;
class TaskSubtaskCollection extends JsonSerializableCollection {
public function __construct(array $data = []) {
parent::__construct($data, TaskSubtaskObject::class, 'string');
}
}
@@ -0,0 +1,13 @@
<?php
declare(strict_types=1);
namespace KTXF\Chrono\Entity\Property;
use KTXF\Json\JsonSerializableObject;
class TaskSubtaskObject extends JsonSerializableObject {
public ?string $label = null;
public bool $completed = false;
public ?int $priority = null;
}
+41
View File
@@ -0,0 +1,41 @@
<?php
declare(strict_types=1);
namespace KTXF\Chrono\Entity;
use DateTimeInterface;
use KTXF\Chrono\Entity\Property\AttachmentCollection;
use KTXF\Chrono\Entity\Property\TagCollection;
use KTXF\Chrono\Entity\Property\TaskRecurrenceObject;
use KTXF\Chrono\Entity\Property\TaskStatusTypes;
use KTXF\Chrono\Entity\Property\TaskSubtaskCollection;
use KTXF\Json\JsonSerializableObject;
class TaskObject extends JsonSerializableObject {
public string $type = 'task';
public int $version = 1;
public ?string $urid = null;
public ?DateTimeInterface $created = null;
public ?DateTimeInterface $modified = null;
public ?string $label = null;
public ?string $description = null;
public TagCollection $tags;
public ?DateTimeInterface $startsOn = null;
public ?DateTimeInterface $dueOn = null;
public ?DateTimeInterface $completedOn = null;
public ?TaskStatusTypes $status = null;
public ?int $priority = null;
public ?int $progress = null;
public ?string $color = null;
public ?TaskRecurrenceObject $recurrence = null;
public TaskSubtaskCollection $subtasks;
public AttachmentCollection $attachments;
public ?string $notes = null;
public function __construct() {
$this->tags = new TagCollection();
$this->subtasks = new TaskSubtaskCollection();
$this->attachments = new AttachmentCollection();
}
}
@@ -1,20 +0,0 @@
<?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');
}
}