addType('resourceId','integer'); $this->addType('permissionLevel','integer'); $this->addType('principalType','integer'); $this->addType('createdTimestamp','integer'); $this->addType('lastUpdatedTimestamp','integer'); } public function getPrincipal(): Principal { return new Principal(PrincipalType::from($this->principalType), $this->principalId); } public function setPrincipal(Principal $principal) { $this->setPrincipalType($principal->getType()->value); $this->setPrincipalId($principal->getId()); } public function jsonSerialize(): array { return [ 'id' => $this->id, 'resourceId' => $this->resourceId, 'permissionLevel' => $this->permissionLevel, 'principal' => $this->getPrincipal(), 'createdTimestamp' => $this->createdTimestamp, 'lastUpdatedTimestamp' => $this->lastUpdatedTimestamp, ]; } public function tableSerialize(?array $params = null): array { return [ 'Id' => $this->id, 'Resource Id' => $this->resourceId, 'Permission Level' => MemberPermissionLevel::from($this->permissionLevel)->name, 'Principal Type' => PrincipalType::from($this->principalType)->name, 'Principal Id' => $this->principalId, 'Created' => $this->createdTimestamp, 'LastUpdated' => $this->lastUpdatedTimestamp, ]; } }