title = $title; $this->body = $body; $this->claimable = $claimable; $this->hasClaimed = $hasClaimed; } public function jsonSerialize(): mixed { foreach ($this->claimable as &$claim) { if($claim['type'] === 'Inventory') $claim['id'] = Uuid::fromString($claim['id'])->getHex()->toString(); } $data = [ 'title' => $this->title, 'body' => $this->body, ]; if ($this->claimable !== null) $data['claimable'] = [ 'data' => $this->claimable, 'state' => $this->hasClaimed ? 'CLAIMED' : 'NONE', ]; return $data; } }