<?php
 declare(strict_types=1); namespace Square\Models; use stdClass; class LoyaltyProgramAccrualRule implements \JsonSerializable { private $accrualType; private $points; private $visitData; private $spendData; private $itemVariationData; private $categoryData; public function __construct(string $accrualType) { $this->accrualType = $accrualType; } public function getAccrualType(): string { return $this->accrualType; } public function setAccrualType(string $accrualType): void { $this->accrualType = $accrualType; } public function getPoints(): ?int { return $this->points; } public function setPoints(?int $points): void { $this->points = $points; } public function getVisitData(): ?LoyaltyProgramAccrualRuleVisitData { return $this->visitData; } public function setVisitData(?LoyaltyProgramAccrualRuleVisitData $visitData): void { $this->visitData = $visitData; } public function getSpendData(): ?LoyaltyProgramAccrualRuleSpendData { return $this->spendData; } public function setSpendData(?LoyaltyProgramAccrualRuleSpendData $spendData): void { $this->spendData = $spendData; } public function getItemVariationData(): ?LoyaltyProgramAccrualRuleItemVariationData { return $this->itemVariationData; } public function setItemVariationData(?LoyaltyProgramAccrualRuleItemVariationData $itemVariationData): void { $this->itemVariationData = $itemVariationData; } public function getCategoryData(): ?LoyaltyProgramAccrualRuleCategoryData { return $this->categoryData; } public function setCategoryData(?LoyaltyProgramAccrualRuleCategoryData $categoryData): void { $this->categoryData = $categoryData; } #[\ReturnTypeWillChange] public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; $json['accrual_type'] = $this->accrualType; if (isset($this->points)) { $json['points'] = $this->points; } if (isset($this->visitData)) { $json['visit_data'] = $this->visitData; } if (isset($this->spendData)) { $json['spend_data'] = $this->spendData; } if (isset($this->itemVariationData)) { $json['item_variation_data'] = $this->itemVariationData; } if (isset($this->categoryData)) { $json['category_data'] = $this->categoryData; } $json = array_filter($json, function ($val) { return $val !== null; }); return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; } } 