true, self::CAPABILITY_SERVICE_FETCH => true, self::CAPABILITY_SERVICE_EXTANT => true, self::CAPABILITY_SERVICE_FRESH => true, self::CAPABILITY_SERVICE_CREATE => true, self::CAPABILITY_SERVICE_MODIFY => true, self::CAPABILITY_SERVICE_DESTROY => true, ]; } public function id(): string { return 'jmap'; } public function label(): string { return 'JMAP Calendar Provider'; } public function serviceList(string $tenantId, string $userId, array $filter): array { // Filter by Calendar capability return $this->serviceStore->listServices($tenantId, $userId, [self::CALENDAR_CAPABILITY]); } public function serviceExtant(string $tenantId, string $userId, array $identifiers): array { $result = []; foreach ($identifiers as $id) { $service = $this->serviceStore->getService($tenantId, $userId, $id); $result[$id] = $service !== null; } return $result; } public function serviceFetch(string $tenantId, string $userId, string|int $identifier): ?IServiceBase { return $this->serviceStore->getService($tenantId, $userId, $identifier); } public function serviceFresh(string $userId = ''): IServiceBase { return new Service( scope: ServiceScope::User, enabled: true, ); } public function serviceCreate(string $userId, IServiceBase $service): string { if (!($service instanceof Service)) { throw new \InvalidArgumentException('Service must be instance of JMAP Service'); } throw new \RuntimeException('Use Mail Provider interface for service creation'); } public function serviceModify(string $userId, IServiceBase $service): string { if (!($service instanceof Service)) { throw new \InvalidArgumentException('Service must be instance of JMAP Service'); } throw new \RuntimeException('Use Mail Provider interface for service modification'); } public function serviceDestroy(string $userId, IServiceBase $service): bool { if (!($service instanceof Service)) { return false; } throw new \RuntimeException('Use Mail Provider interface for service destruction'); } public function jsonSerialize(): array { return [ '@type' => 'chrono.provider', 'id' => $this->id(), 'label' => $this->label(), 'capabilities' => $this->capabilities(), ]; } public function jsonDeserialize(array|string $data): static { return $this; } }