<?php
 declare(strict_types=1); namespace Square\Models; use stdClass; class LoyaltyProgramRewardDefinition implements \JsonSerializable { private $scope; private $discountType; private $percentageDiscount; private $catalogObjectIds; private $fixedDiscountMoney; private $maxDiscountMoney; public function __construct(string $scope, string $discountType) { $this->scope = $scope; $this->discountType = $discountType; } public function getScope(): string { return $this->scope; } public function setScope(string $scope): void { $this->scope = $scope; } public function getDiscountType(): string { return $this->discountType; } public function setDiscountType(string $discountType): void { $this->discountType = $discountType; } public function getPercentageDiscount(): ?string { return $this->percentageDiscount; } public function setPercentageDiscount(?string $percentageDiscount): void { $this->percentageDiscount = $percentageDiscount; } public function getCatalogObjectIds(): ?array { return $this->catalogObjectIds; } public function setCatalogObjectIds(?array $catalogObjectIds): void { $this->catalogObjectIds = $catalogObjectIds; } public function getFixedDiscountMoney(): ?Money { return $this->fixedDiscountMoney; } public function setFixedDiscountMoney(?Money $fixedDiscountMoney): void { $this->fixedDiscountMoney = $fixedDiscountMoney; } public function getMaxDiscountMoney(): ?Money { return $this->maxDiscountMoney; } public function setMaxDiscountMoney(?Money $maxDiscountMoney): void { $this->maxDiscountMoney = $maxDiscountMoney; } #[\ReturnTypeWillChange] public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; $json['scope'] = $this->scope; $json['discount_type'] = $this->discountType; if (isset($this->percentageDiscount)) { $json['percentage_discount'] = $this->percentageDiscount; } if (isset($this->catalogObjectIds)) { $json['catalog_object_ids'] = $this->catalogObjectIds; } if (isset($this->fixedDiscountMoney)) { $json['fixed_discount_money'] = $this->fixedDiscountMoney; } if (isset($this->maxDiscountMoney)) { $json['max_discount_money'] = $this->maxDiscountMoney; } $json = array_filter($json, function ($val) { return $val !== null; }); return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; } } 