<?php
 declare(strict_types=1); namespace Square\Models; use stdClass; class JobAssignment implements \JsonSerializable { private $jobTitle; private $payType; private $hourlyRate; private $annualRate; private $weeklyHours; public function __construct(string $jobTitle, string $payType) { $this->jobTitle = $jobTitle; $this->payType = $payType; } public function getJobTitle(): string { return $this->jobTitle; } public function setJobTitle(string $jobTitle): void { $this->jobTitle = $jobTitle; } public function getPayType(): string { return $this->payType; } public function setPayType(string $payType): void { $this->payType = $payType; } public function getHourlyRate(): ?Money { return $this->hourlyRate; } public function setHourlyRate(?Money $hourlyRate): void { $this->hourlyRate = $hourlyRate; } public function getAnnualRate(): ?Money { return $this->annualRate; } public function setAnnualRate(?Money $annualRate): void { $this->annualRate = $annualRate; } public function getWeeklyHours(): ?int { return $this->weeklyHours; } public function setWeeklyHours(?int $weeklyHours): void { $this->weeklyHours = $weeklyHours; } #[\ReturnTypeWillChange] public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; $json['job_title'] = $this->jobTitle; $json['pay_type'] = $this->payType; if (isset($this->hourlyRate)) { $json['hourly_rate'] = $this->hourlyRate; } if (isset($this->annualRate)) { $json['annual_rate'] = $this->annualRate; } if (isset($this->weeklyHours)) { $json['weekly_hours'] = $this->weeklyHours; } $json = array_filter($json, function ($val) { return $val !== null; }); return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; } } 