type = $type; $this->htmlContent = $htmlContent; $this->plainContent = $plainContent; $this->product = $product; $this->userId = $userId; $this->coupon = $coupon; } public static function fromBody(array $body): PromotionalEmailPreviewRequest { return new PromotionalEmailPreviewRequest( $body['type'] ?? null, $body['htmlContent'] ?? null, $body['plainContent'] ?? null, Product::fromBody($body['product'] ?? []), $body['userId'] ?? null, $body['coupon'] ?? null ); } }