*/ class UpdateEmployeeRequest implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ protected static $openAPIModelName = 'UpdateEmployeeRequest'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ protected static $openAPITypes = [ 'first_name' => 'string', 'last_name' => 'string', 'status' => 'string', 'date_of_birth' => '\DateTime', 'street' => 'string', 'postal_code' => 'string', 'city' => 'string', 'country' => 'string', 'phone_number' => 'string', 'email' => 'string', 'entry_date' => '\DateTime', 'exit_date' => '\DateTime', 'emergency_contact_name' => 'string', 'emergency_contact_phone' => 'string', 'emergency_contact_relation' => 'string', 'employment_type' => 'string', 'qualification' => 'string', 'avatar_file_name' => 'string' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] * @phpstan-var array * @psalm-var array */ protected static $openAPIFormats = [ 'first_name' => null, 'last_name' => null, 'status' => null, 'date_of_birth' => 'date', 'street' => null, 'postal_code' => null, 'city' => null, 'country' => null, 'phone_number' => null, 'email' => null, 'entry_date' => 'date', 'exit_date' => 'date', 'emergency_contact_name' => null, 'emergency_contact_phone' => null, 'emergency_contact_relation' => null, 'employment_type' => null, 'qualification' => null, 'avatar_file_name' => null ]; /** * Array of nullable properties. Used for (de)serialization * * @var boolean[] */ protected static array $openAPINullables = [ 'first_name' => true, 'last_name' => true, 'status' => true, 'date_of_birth' => true, 'street' => true, 'postal_code' => true, 'city' => true, 'country' => true, 'phone_number' => true, 'email' => true, 'entry_date' => true, 'exit_date' => true, 'emergency_contact_name' => true, 'emergency_contact_phone' => true, 'emergency_contact_relation' => true, 'employment_type' => true, 'qualification' => true, 'avatar_file_name' => true ]; /** * 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 = [ 'first_name' => 'firstName', 'last_name' => 'lastName', 'status' => 'status', 'date_of_birth' => 'dateOfBirth', 'street' => 'street', 'postal_code' => 'postalCode', 'city' => 'city', 'country' => 'country', 'phone_number' => 'phoneNumber', 'email' => 'email', 'entry_date' => 'entryDate', 'exit_date' => 'exitDate', 'emergency_contact_name' => 'emergencyContactName', 'emergency_contact_phone' => 'emergencyContactPhone', 'emergency_contact_relation' => 'emergencyContactRelation', 'employment_type' => 'employmentType', 'qualification' => 'qualification', 'avatar_file_name' => 'avatarFileName' ]; /** * Array of attributes to setter functions (for deserialization of responses) * * @var string[] */ protected static $setters = [ 'first_name' => 'setFirstName', 'last_name' => 'setLastName', 'status' => 'setStatus', 'date_of_birth' => 'setDateOfBirth', 'street' => 'setStreet', 'postal_code' => 'setPostalCode', 'city' => 'setCity', 'country' => 'setCountry', 'phone_number' => 'setPhoneNumber', 'email' => 'setEmail', 'entry_date' => 'setEntryDate', 'exit_date' => 'setExitDate', 'emergency_contact_name' => 'setEmergencyContactName', 'emergency_contact_phone' => 'setEmergencyContactPhone', 'emergency_contact_relation' => 'setEmergencyContactRelation', 'employment_type' => 'setEmploymentType', 'qualification' => 'setQualification', 'avatar_file_name' => 'setAvatarFileName' ]; /** * Array of attributes to getter functions (for serialization of requests) * * @var string[] */ protected static $getters = [ 'first_name' => 'getFirstName', 'last_name' => 'getLastName', 'status' => 'getStatus', 'date_of_birth' => 'getDateOfBirth', 'street' => 'getStreet', 'postal_code' => 'getPostalCode', 'city' => 'getCity', 'country' => 'getCountry', 'phone_number' => 'getPhoneNumber', 'email' => 'getEmail', 'entry_date' => 'getEntryDate', 'exit_date' => 'getExitDate', 'emergency_contact_name' => 'getEmergencyContactName', 'emergency_contact_phone' => 'getEmergencyContactPhone', 'emergency_contact_relation' => 'getEmergencyContactRelation', 'employment_type' => 'getEmploymentType', 'qualification' => 'getQualification', 'avatar_file_name' => 'getAvatarFileName' ]; /** * 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('first_name', $data ?? [], null); $this->setIfExists('last_name', $data ?? [], null); $this->setIfExists('status', $data ?? [], null); $this->setIfExists('date_of_birth', $data ?? [], null); $this->setIfExists('street', $data ?? [], null); $this->setIfExists('postal_code', $data ?? [], null); $this->setIfExists('city', $data ?? [], null); $this->setIfExists('country', $data ?? [], null); $this->setIfExists('phone_number', $data ?? [], null); $this->setIfExists('email', $data ?? [], null); $this->setIfExists('entry_date', $data ?? [], null); $this->setIfExists('exit_date', $data ?? [], null); $this->setIfExists('emergency_contact_name', $data ?? [], null); $this->setIfExists('emergency_contact_phone', $data ?? [], null); $this->setIfExists('emergency_contact_relation', $data ?? [], null); $this->setIfExists('employment_type', $data ?? [], null); $this->setIfExists('qualification', $data ?? [], null); $this->setIfExists('avatar_file_name', $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 first_name * * @return string|null */ public function getFirstName() { return $this->container['first_name']; } /** * Sets first_name * * @param string|null $first_name first_name * * @return self */ public function setFirstName($first_name) { if (is_null($first_name)) { array_push($this->openAPINullablesSetToNull, 'first_name'); } else { $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); $index = array_search('first_name', $nullablesSetToNull); if ($index !== FALSE) { unset($nullablesSetToNull[$index]); $this->setOpenAPINullablesSetToNull($nullablesSetToNull); } } $this->container['first_name'] = $first_name; return $this; } /** * Gets last_name * * @return string|null */ public function getLastName() { return $this->container['last_name']; } /** * Sets last_name * * @param string|null $last_name last_name * * @return self */ public function setLastName($last_name) { if (is_null($last_name)) { array_push($this->openAPINullablesSetToNull, 'last_name'); } else { $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); $index = array_search('last_name', $nullablesSetToNull); if ($index !== FALSE) { unset($nullablesSetToNull[$index]); $this->setOpenAPINullablesSetToNull($nullablesSetToNull); } } $this->container['last_name'] = $last_name; return $this; } /** * Gets status * * @return string|null */ public function getStatus() { return $this->container['status']; } /** * Sets status * * @param string|null $status status * * @return self */ public function setStatus($status) { if (is_null($status)) { array_push($this->openAPINullablesSetToNull, 'status'); } else { $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); $index = array_search('status', $nullablesSetToNull); if ($index !== FALSE) { unset($nullablesSetToNull[$index]); $this->setOpenAPINullablesSetToNull($nullablesSetToNull); } } $this->container['status'] = $status; return $this; } /** * Gets date_of_birth * * @return \DateTime|null */ public function getDateOfBirth() { return $this->container['date_of_birth']; } /** * Sets date_of_birth * * @param \DateTime|null $date_of_birth date_of_birth * * @return self */ public function setDateOfBirth($date_of_birth) { if (is_null($date_of_birth)) { array_push($this->openAPINullablesSetToNull, 'date_of_birth'); } else { $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); $index = array_search('date_of_birth', $nullablesSetToNull); if ($index !== FALSE) { unset($nullablesSetToNull[$index]); $this->setOpenAPINullablesSetToNull($nullablesSetToNull); } } $this->container['date_of_birth'] = $date_of_birth; return $this; } /** * Gets street * * @return string|null */ public function getStreet() { return $this->container['street']; } /** * Sets street * * @param string|null $street street * * @return self */ public function setStreet($street) { if (is_null($street)) { array_push($this->openAPINullablesSetToNull, 'street'); } else { $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); $index = array_search('street', $nullablesSetToNull); if ($index !== FALSE) { unset($nullablesSetToNull[$index]); $this->setOpenAPINullablesSetToNull($nullablesSetToNull); } } $this->container['street'] = $street; return $this; } /** * Gets postal_code * * @return string|null */ public function getPostalCode() { return $this->container['postal_code']; } /** * Sets postal_code * * @param string|null $postal_code postal_code * * @return self */ public function setPostalCode($postal_code) { if (is_null($postal_code)) { array_push($this->openAPINullablesSetToNull, 'postal_code'); } else { $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); $index = array_search('postal_code', $nullablesSetToNull); if ($index !== FALSE) { unset($nullablesSetToNull[$index]); $this->setOpenAPINullablesSetToNull($nullablesSetToNull); } } $this->container['postal_code'] = $postal_code; return $this; } /** * Gets city * * @return string|null */ public function getCity() { return $this->container['city']; } /** * Sets city * * @param string|null $city city * * @return self */ public function setCity($city) { if (is_null($city)) { array_push($this->openAPINullablesSetToNull, 'city'); } else { $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); $index = array_search('city', $nullablesSetToNull); if ($index !== FALSE) { unset($nullablesSetToNull[$index]); $this->setOpenAPINullablesSetToNull($nullablesSetToNull); } } $this->container['city'] = $city; return $this; } /** * Gets country * * @return string|null */ public function getCountry() { return $this->container['country']; } /** * Sets country * * @param string|null $country country * * @return self */ public function setCountry($country) { if (is_null($country)) { array_push($this->openAPINullablesSetToNull, 'country'); } else { $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); $index = array_search('country', $nullablesSetToNull); if ($index !== FALSE) { unset($nullablesSetToNull[$index]); $this->setOpenAPINullablesSetToNull($nullablesSetToNull); } } $this->container['country'] = $country; return $this; } /** * Gets phone_number * * @return string|null */ public function getPhoneNumber() { return $this->container['phone_number']; } /** * Sets phone_number * * @param string|null $phone_number phone_number * * @return self */ public function setPhoneNumber($phone_number) { if (is_null($phone_number)) { array_push($this->openAPINullablesSetToNull, 'phone_number'); } else { $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); $index = array_search('phone_number', $nullablesSetToNull); if ($index !== FALSE) { unset($nullablesSetToNull[$index]); $this->setOpenAPINullablesSetToNull($nullablesSetToNull); } } $this->container['phone_number'] = $phone_number; return $this; } /** * Gets email * * @return string|null */ public function getEmail() { return $this->container['email']; } /** * Sets email * * @param string|null $email email * * @return self */ public function setEmail($email) { if (is_null($email)) { array_push($this->openAPINullablesSetToNull, 'email'); } else { $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); $index = array_search('email', $nullablesSetToNull); if ($index !== FALSE) { unset($nullablesSetToNull[$index]); $this->setOpenAPINullablesSetToNull($nullablesSetToNull); } } $this->container['email'] = $email; return $this; } /** * Gets entry_date * * @return \DateTime|null */ public function getEntryDate() { return $this->container['entry_date']; } /** * Sets entry_date * * @param \DateTime|null $entry_date entry_date * * @return self */ public function setEntryDate($entry_date) { if (is_null($entry_date)) { array_push($this->openAPINullablesSetToNull, 'entry_date'); } else { $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); $index = array_search('entry_date', $nullablesSetToNull); if ($index !== FALSE) { unset($nullablesSetToNull[$index]); $this->setOpenAPINullablesSetToNull($nullablesSetToNull); } } $this->container['entry_date'] = $entry_date; return $this; } /** * Gets exit_date * * @return \DateTime|null */ public function getExitDate() { return $this->container['exit_date']; } /** * Sets exit_date * * @param \DateTime|null $exit_date exit_date * * @return self */ public function setExitDate($exit_date) { if (is_null($exit_date)) { array_push($this->openAPINullablesSetToNull, 'exit_date'); } else { $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); $index = array_search('exit_date', $nullablesSetToNull); if ($index !== FALSE) { unset($nullablesSetToNull[$index]); $this->setOpenAPINullablesSetToNull($nullablesSetToNull); } } $this->container['exit_date'] = $exit_date; return $this; } /** * Gets emergency_contact_name * * @return string|null */ public function getEmergencyContactName() { return $this->container['emergency_contact_name']; } /** * Sets emergency_contact_name * * @param string|null $emergency_contact_name emergency_contact_name * * @return self */ public function setEmergencyContactName($emergency_contact_name) { if (is_null($emergency_contact_name)) { array_push($this->openAPINullablesSetToNull, 'emergency_contact_name'); } else { $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); $index = array_search('emergency_contact_name', $nullablesSetToNull); if ($index !== FALSE) { unset($nullablesSetToNull[$index]); $this->setOpenAPINullablesSetToNull($nullablesSetToNull); } } $this->container['emergency_contact_name'] = $emergency_contact_name; return $this; } /** * Gets emergency_contact_phone * * @return string|null */ public function getEmergencyContactPhone() { return $this->container['emergency_contact_phone']; } /** * Sets emergency_contact_phone * * @param string|null $emergency_contact_phone emergency_contact_phone * * @return self */ public function setEmergencyContactPhone($emergency_contact_phone) { if (is_null($emergency_contact_phone)) { array_push($this->openAPINullablesSetToNull, 'emergency_contact_phone'); } else { $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); $index = array_search('emergency_contact_phone', $nullablesSetToNull); if ($index !== FALSE) { unset($nullablesSetToNull[$index]); $this->setOpenAPINullablesSetToNull($nullablesSetToNull); } } $this->container['emergency_contact_phone'] = $emergency_contact_phone; return $this; } /** * Gets emergency_contact_relation * * @return string|null */ public function getEmergencyContactRelation() { return $this->container['emergency_contact_relation']; } /** * Sets emergency_contact_relation * * @param string|null $emergency_contact_relation emergency_contact_relation * * @return self */ public function setEmergencyContactRelation($emergency_contact_relation) { if (is_null($emergency_contact_relation)) { array_push($this->openAPINullablesSetToNull, 'emergency_contact_relation'); } else { $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); $index = array_search('emergency_contact_relation', $nullablesSetToNull); if ($index !== FALSE) { unset($nullablesSetToNull[$index]); $this->setOpenAPINullablesSetToNull($nullablesSetToNull); } } $this->container['emergency_contact_relation'] = $emergency_contact_relation; return $this; } /** * Gets employment_type * * @return string|null */ public function getEmploymentType() { return $this->container['employment_type']; } /** * Sets employment_type * * @param string|null $employment_type employment_type * * @return self */ public function setEmploymentType($employment_type) { if (is_null($employment_type)) { array_push($this->openAPINullablesSetToNull, 'employment_type'); } else { $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); $index = array_search('employment_type', $nullablesSetToNull); if ($index !== FALSE) { unset($nullablesSetToNull[$index]); $this->setOpenAPINullablesSetToNull($nullablesSetToNull); } } $this->container['employment_type'] = $employment_type; return $this; } /** * Gets qualification * * @return string|null */ public function getQualification() { return $this->container['qualification']; } /** * Sets qualification * * @param string|null $qualification qualification * * @return self */ public function setQualification($qualification) { if (is_null($qualification)) { array_push($this->openAPINullablesSetToNull, 'qualification'); } else { $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); $index = array_search('qualification', $nullablesSetToNull); if ($index !== FALSE) { unset($nullablesSetToNull[$index]); $this->setOpenAPINullablesSetToNull($nullablesSetToNull); } } $this->container['qualification'] = $qualification; return $this; } /** * Gets avatar_file_name * * @return string|null */ public function getAvatarFileName() { return $this->container['avatar_file_name']; } /** * Sets avatar_file_name * * @param string|null $avatar_file_name avatar_file_name * * @return self */ public function setAvatarFileName($avatar_file_name) { if (is_null($avatar_file_name)) { array_push($this->openAPINullablesSetToNull, 'avatar_file_name'); } else { $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); $index = array_search('avatar_file_name', $nullablesSetToNull); if ($index !== FALSE) { unset($nullablesSetToNull[$index]); $this->setOpenAPINullablesSetToNull($nullablesSetToNull); } } $this->container['avatar_file_name'] = $avatar_file_name; 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)); } }