*/ class TimeEntryResponse implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ protected static $openAPIModelName = 'TimeEntryResponse'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ protected static $openAPITypes = [ 'id' => 'string', 'employee_id' => 'string', 'employee_name' => 'string', 'order_id' => 'string', 'facility_id' => 'string', 'facility_name' => 'string', 'date' => '\DateTime', 'start' => 'string', 'end' => 'string', 'break_duration' => 'string', 'night_hours' => 'float', 'saturday_hours' => 'float', 'sunday_hours' => 'float', 'holiday_hours' => 'float', 'status_id' => 'string', 'status_name' => 'string', 'is_editable_by_owner' => 'bool', 'admin_note' => 'string', 'created_at' => '\DateTime' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] * @phpstan-var array * @psalm-var array */ protected static $openAPIFormats = [ 'id' => 'uuid', 'employee_id' => 'uuid', 'employee_name' => null, 'order_id' => 'uuid', 'facility_id' => 'uuid', 'facility_name' => null, 'date' => 'date', 'start' => 'time', 'end' => 'time', 'break_duration' => 'date-span', 'night_hours' => 'double', 'saturday_hours' => 'double', 'sunday_hours' => 'double', 'holiday_hours' => 'double', 'status_id' => 'uuid', 'status_name' => null, 'is_editable_by_owner' => null, 'admin_note' => null, 'created_at' => 'date-time' ]; /** * Array of nullable properties. Used for (de)serialization * * @var boolean[] */ protected static array $openAPINullables = [ 'id' => false, 'employee_id' => false, 'employee_name' => true, 'order_id' => false, 'facility_id' => false, 'facility_name' => true, 'date' => false, 'start' => false, 'end' => false, 'break_duration' => false, 'night_hours' => false, 'saturday_hours' => false, 'sunday_hours' => false, 'holiday_hours' => false, 'status_id' => false, 'status_name' => true, 'is_editable_by_owner' => false, 'admin_note' => true, 'created_at' => false ]; /** * If a nullable field gets set to null, insert it here * * @var boolean[] */ protected array $openAPINullablesSetToNull = []; /** * Array of property to type mappings. Used for (de)serialization * * @return array */ public static function openAPITypes() { return self::$openAPITypes; } /** * Array of property to format mappings. Used for (de)serialization * * @return array */ public static function openAPIFormats() { return self::$openAPIFormats; } /** * Array of nullable properties * * @return array */ protected static function openAPINullables(): array { return self::$openAPINullables; } /** * Array of nullable field names deliberately set to null * * @return boolean[] */ private function getOpenAPINullablesSetToNull(): array { return $this->openAPINullablesSetToNull; } /** * Setter - Array of nullable field names deliberately set to null * * @param boolean[] $openAPINullablesSetToNull */ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** * Checks if a property is nullable * * @param string $property * @return bool */ public static function isNullable(string $property): bool { return self::openAPINullables()[$property] ?? false; } /** * Checks if a nullable property is set to null. * * @param string $property * @return bool */ public function isNullableSetToNull(string $property): bool { return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** * Array of attributes where the key is the local name, * and the value is the original name * * @var string[] */ protected static $attributeMap = [ 'id' => 'id', 'employee_id' => 'employeeId', 'employee_name' => 'employeeName', 'order_id' => 'orderId', 'facility_id' => 'facilityId', 'facility_name' => 'facilityName', 'date' => 'date', 'start' => 'start', 'end' => 'end', 'break_duration' => 'breakDuration', 'night_hours' => 'nightHours', 'saturday_hours' => 'saturdayHours', 'sunday_hours' => 'sundayHours', 'holiday_hours' => 'holidayHours', 'status_id' => 'statusId', 'status_name' => 'statusName', 'is_editable_by_owner' => 'isEditableByOwner', 'admin_note' => 'adminNote', 'created_at' => 'createdAt' ]; /** * Array of attributes to setter functions (for deserialization of responses) * * @var string[] */ protected static $setters = [ 'id' => 'setId', 'employee_id' => 'setEmployeeId', 'employee_name' => 'setEmployeeName', 'order_id' => 'setOrderId', 'facility_id' => 'setFacilityId', 'facility_name' => 'setFacilityName', 'date' => 'setDate', 'start' => 'setStart', 'end' => 'setEnd', 'break_duration' => 'setBreakDuration', 'night_hours' => 'setNightHours', 'saturday_hours' => 'setSaturdayHours', 'sunday_hours' => 'setSundayHours', 'holiday_hours' => 'setHolidayHours', 'status_id' => 'setStatusId', 'status_name' => 'setStatusName', 'is_editable_by_owner' => 'setIsEditableByOwner', 'admin_note' => 'setAdminNote', 'created_at' => 'setCreatedAt' ]; /** * Array of attributes to getter functions (for serialization of requests) * * @var string[] */ protected static $getters = [ 'id' => 'getId', 'employee_id' => 'getEmployeeId', 'employee_name' => 'getEmployeeName', 'order_id' => 'getOrderId', 'facility_id' => 'getFacilityId', 'facility_name' => 'getFacilityName', 'date' => 'getDate', 'start' => 'getStart', 'end' => 'getEnd', 'break_duration' => 'getBreakDuration', 'night_hours' => 'getNightHours', 'saturday_hours' => 'getSaturdayHours', 'sunday_hours' => 'getSundayHours', 'holiday_hours' => 'getHolidayHours', 'status_id' => 'getStatusId', 'status_name' => 'getStatusName', 'is_editable_by_owner' => 'getIsEditableByOwner', 'admin_note' => 'getAdminNote', 'created_at' => 'getCreatedAt' ]; /** * Array of attributes where the key is the local name, * and the value is the original name * * @return array */ public static function attributeMap() { return self::$attributeMap; } /** * Array of attributes to setter functions (for deserialization of responses) * * @return array */ public static function setters() { return self::$setters; } /** * Array of attributes to getter functions (for serialization of requests) * * @return array */ public static function getters() { return self::$getters; } /** * The original name of the model. * * @return string */ public function getModelName() { return self::$openAPIModelName; } /** * Associative array for storing property values * * @var mixed[] */ protected $container = []; /** * Constructor * * @param mixed[]|null $data Associated array of property values * initializing the model */ public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); $this->setIfExists('employee_id', $data ?? [], null); $this->setIfExists('employee_name', $data ?? [], null); $this->setIfExists('order_id', $data ?? [], null); $this->setIfExists('facility_id', $data ?? [], null); $this->setIfExists('facility_name', $data ?? [], null); $this->setIfExists('date', $data ?? [], null); $this->setIfExists('start', $data ?? [], null); $this->setIfExists('end', $data ?? [], null); $this->setIfExists('break_duration', $data ?? [], null); $this->setIfExists('night_hours', $data ?? [], null); $this->setIfExists('saturday_hours', $data ?? [], null); $this->setIfExists('sunday_hours', $data ?? [], null); $this->setIfExists('holiday_hours', $data ?? [], null); $this->setIfExists('status_id', $data ?? [], null); $this->setIfExists('status_name', $data ?? [], null); $this->setIfExists('is_editable_by_owner', $data ?? [], null); $this->setIfExists('admin_note', $data ?? [], null); $this->setIfExists('created_at', $data ?? [], null); } /** * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the * $this->openAPINullablesSetToNull array * * @param string $variableName * @param array $fields * @param mixed $defaultValue */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { $this->openAPINullablesSetToNull[] = $variableName; } $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { $invalidProperties = []; return $invalidProperties; } /** * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid */ public function valid() { return count($this->listInvalidProperties()) === 0; } /** * Gets id * * @return string|null */ public function getId() { return $this->container['id']; } /** * Sets id * * @param string|null $id id * * @return self */ public function setId($id) { if (is_null($id)) { throw new \InvalidArgumentException('non-nullable id cannot be null'); } $this->container['id'] = $id; return $this; } /** * Gets employee_id * * @return string|null */ public function getEmployeeId() { return $this->container['employee_id']; } /** * Sets employee_id * * @param string|null $employee_id employee_id * * @return self */ public function setEmployeeId($employee_id) { if (is_null($employee_id)) { throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); } $this->container['employee_id'] = $employee_id; return $this; } /** * Gets employee_name * * @return string|null */ public function getEmployeeName() { return $this->container['employee_name']; } /** * Sets employee_name * * @param string|null $employee_name employee_name * * @return self */ public function setEmployeeName($employee_name) { if (is_null($employee_name)) { array_push($this->openAPINullablesSetToNull, 'employee_name'); } else { $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); $index = array_search('employee_name', $nullablesSetToNull); if ($index !== FALSE) { unset($nullablesSetToNull[$index]); $this->setOpenAPINullablesSetToNull($nullablesSetToNull); } } $this->container['employee_name'] = $employee_name; return $this; } /** * Gets order_id * * @return string|null */ public function getOrderId() { return $this->container['order_id']; } /** * Sets order_id * * @param string|null $order_id order_id * * @return self */ public function setOrderId($order_id) { if (is_null($order_id)) { throw new \InvalidArgumentException('non-nullable order_id cannot be null'); } $this->container['order_id'] = $order_id; return $this; } /** * Gets facility_id * * @return string|null */ public function getFacilityId() { return $this->container['facility_id']; } /** * Sets facility_id * * @param string|null $facility_id facility_id * * @return self */ public function setFacilityId($facility_id) { if (is_null($facility_id)) { throw new \InvalidArgumentException('non-nullable facility_id cannot be null'); } $this->container['facility_id'] = $facility_id; return $this; } /** * Gets facility_name * * @return string|null */ public function getFacilityName() { return $this->container['facility_name']; } /** * Sets facility_name * * @param string|null $facility_name facility_name * * @return self */ public function setFacilityName($facility_name) { if (is_null($facility_name)) { array_push($this->openAPINullablesSetToNull, 'facility_name'); } else { $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); $index = array_search('facility_name', $nullablesSetToNull); if ($index !== FALSE) { unset($nullablesSetToNull[$index]); $this->setOpenAPINullablesSetToNull($nullablesSetToNull); } } $this->container['facility_name'] = $facility_name; return $this; } /** * Gets date * * @return \DateTime|null */ public function getDate() { return $this->container['date']; } /** * Sets date * * @param \DateTime|null $date date * * @return self */ public function setDate($date) { if (is_null($date)) { throw new \InvalidArgumentException('non-nullable date cannot be null'); } $this->container['date'] = $date; return $this; } /** * Gets start * * @return string|null */ public function getStart() { return $this->container['start']; } /** * Sets start * * @param string|null $start start * * @return self */ public function setStart($start) { if (is_null($start)) { throw new \InvalidArgumentException('non-nullable start cannot be null'); } $this->container['start'] = $start; return $this; } /** * Gets end * * @return string|null */ public function getEnd() { return $this->container['end']; } /** * Sets end * * @param string|null $end end * * @return self */ public function setEnd($end) { if (is_null($end)) { throw new \InvalidArgumentException('non-nullable end cannot be null'); } $this->container['end'] = $end; return $this; } /** * Gets break_duration * * @return string|null */ public function getBreakDuration() { return $this->container['break_duration']; } /** * Sets break_duration * * @param string|null $break_duration break_duration * * @return self */ public function setBreakDuration($break_duration) { if (is_null($break_duration)) { throw new \InvalidArgumentException('non-nullable break_duration cannot be null'); } $this->container['break_duration'] = $break_duration; return $this; } /** * Gets night_hours * * @return float|null */ public function getNightHours() { return $this->container['night_hours']; } /** * Sets night_hours * * @param float|null $night_hours night_hours * * @return self */ public function setNightHours($night_hours) { if (is_null($night_hours)) { throw new \InvalidArgumentException('non-nullable night_hours cannot be null'); } $this->container['night_hours'] = $night_hours; return $this; } /** * Gets saturday_hours * * @return float|null */ public function getSaturdayHours() { return $this->container['saturday_hours']; } /** * Sets saturday_hours * * @param float|null $saturday_hours saturday_hours * * @return self */ public function setSaturdayHours($saturday_hours) { if (is_null($saturday_hours)) { throw new \InvalidArgumentException('non-nullable saturday_hours cannot be null'); } $this->container['saturday_hours'] = $saturday_hours; return $this; } /** * Gets sunday_hours * * @return float|null */ public function getSundayHours() { return $this->container['sunday_hours']; } /** * Sets sunday_hours * * @param float|null $sunday_hours sunday_hours * * @return self */ public function setSundayHours($sunday_hours) { if (is_null($sunday_hours)) { throw new \InvalidArgumentException('non-nullable sunday_hours cannot be null'); } $this->container['sunday_hours'] = $sunday_hours; return $this; } /** * Gets holiday_hours * * @return float|null */ public function getHolidayHours() { return $this->container['holiday_hours']; } /** * Sets holiday_hours * * @param float|null $holiday_hours holiday_hours * * @return self */ public function setHolidayHours($holiday_hours) { if (is_null($holiday_hours)) { throw new \InvalidArgumentException('non-nullable holiday_hours cannot be null'); } $this->container['holiday_hours'] = $holiday_hours; return $this; } /** * Gets status_id * * @return string|null */ public function getStatusId() { return $this->container['status_id']; } /** * Sets status_id * * @param string|null $status_id status_id * * @return self */ public function setStatusId($status_id) { if (is_null($status_id)) { throw new \InvalidArgumentException('non-nullable status_id cannot be null'); } $this->container['status_id'] = $status_id; return $this; } /** * Gets status_name * * @return string|null */ public function getStatusName() { return $this->container['status_name']; } /** * Sets status_name * * @param string|null $status_name status_name * * @return self */ public function setStatusName($status_name) { if (is_null($status_name)) { array_push($this->openAPINullablesSetToNull, 'status_name'); } else { $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); $index = array_search('status_name', $nullablesSetToNull); if ($index !== FALSE) { unset($nullablesSetToNull[$index]); $this->setOpenAPINullablesSetToNull($nullablesSetToNull); } } $this->container['status_name'] = $status_name; return $this; } /** * Gets is_editable_by_owner * * @return bool|null */ public function getIsEditableByOwner() { return $this->container['is_editable_by_owner']; } /** * Sets is_editable_by_owner * * @param bool|null $is_editable_by_owner is_editable_by_owner * * @return self */ public function setIsEditableByOwner($is_editable_by_owner) { if (is_null($is_editable_by_owner)) { throw new \InvalidArgumentException('non-nullable is_editable_by_owner cannot be null'); } $this->container['is_editable_by_owner'] = $is_editable_by_owner; return $this; } /** * Gets admin_note * * @return string|null */ public function getAdminNote() { return $this->container['admin_note']; } /** * Sets admin_note * * @param string|null $admin_note admin_note * * @return self */ public function setAdminNote($admin_note) { if (is_null($admin_note)) { array_push($this->openAPINullablesSetToNull, 'admin_note'); } else { $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); $index = array_search('admin_note', $nullablesSetToNull); if ($index !== FALSE) { unset($nullablesSetToNull[$index]); $this->setOpenAPINullablesSetToNull($nullablesSetToNull); } } $this->container['admin_note'] = $admin_note; return $this; } /** * Gets created_at * * @return \DateTime|null */ public function getCreatedAt() { return $this->container['created_at']; } /** * Sets created_at * * @param \DateTime|null $created_at created_at * * @return self */ public function setCreatedAt($created_at) { if (is_null($created_at)) { throw new \InvalidArgumentException('non-nullable created_at cannot be null'); } $this->container['created_at'] = $created_at; return $this; } /** * Returns true if offset exists. False otherwise. * * @param integer $offset Offset * * @return boolean */ public function offsetExists($offset): bool { return isset($this->container[$offset]); } /** * Gets offset. * * @param integer $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; } /** * Sets value based on offset. * * @param int|null $offset Offset * @param mixed $value Value to be set * * @return void */ public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; } else { $this->container[$offset] = $value; } } /** * Unsets offset. * * @param integer $offset Offset * * @return void */ public function offsetUnset($offset): void { unset($this->container[$offset]); } /** * Serializes the object to a value that can be serialized natively by json_encode(). * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php * * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); } /** * Gets the string presentation of the object * * @return string */ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT ); } /** * Gets a header-safe presentation of the object * * @return string */ public function toHeaderValue() { return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } }