addType('roomId', 'integer'); $this->addType('shareType', 'integer'); $this->addType('permission', 'integer'); } public function jsonSerialize(): array { return [ 'id' => $this->id, 'roomId' => $this->roomId, 'shareType' => $this->shareType, 'shareWith' => $this->shareWith, 'shareWithDisplayName' => $this->shareWithDisplayName, 'permission' => $this->permission, ]; } public function hasUserPermission(): bool { return $this->permission === self::PERMISSION_ADMIN || $this->permission === self::PERMISSION_MODERATOR || $this->permission === self::PERMISSION_USER; } public function hasModeratorPermission(): bool { return $this->permission === self::PERMISSION_ADMIN || $this->permission === self::PERMISSION_MODERATOR; } public function hasAdminPermission(): bool { return $this->permission === self::PERMISSION_ADMIN; } }