*/ class UserResponse implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ protected static $openAPIModelName = 'UserResponse'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ protected static $openAPITypes = [ 'id' => 'string', 'username' => 'string', 'employee_id' => 'string', 'role_name' => 'string', 'is_active' => 'bool', 'must_change_password' => 'bool' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] * @phpstan-var array * @psalm-var array */ protected static $openAPIFormats = [ 'id' => 'uuid', 'username' => null, 'employee_id' => 'uuid', 'role_name' => null, 'is_active' => null, 'must_change_password' => null ]; /** * Array of nullable properties. Used for (de)serialization * * @var boolean[] */ protected static array $openAPINullables = [ 'id' => false, 'username' => true, 'employee_id' => true, 'role_name' => true, 'is_active' => false, 'must_change_password' => 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', 'username' => 'username', 'employee_id' => 'employeeId', 'role_name' => 'roleName', 'is_active' => 'isActive', 'must_change_password' => 'mustChangePassword' ]; /** * Array of attributes to setter functions (for deserialization of responses) * * @var string[] */ protected static $setters = [ 'id' => 'setId', 'username' => 'setUsername', 'employee_id' => 'setEmployeeId', 'role_name' => 'setRoleName', 'is_active' => 'setIsActive', 'must_change_password' => 'setMustChangePassword' ]; /** * Array of attributes to getter functions (for serialization of requests) * * @var string[] */ protected static $getters = [ 'id' => 'getId', 'username' => 'getUsername', 'employee_id' => 'getEmployeeId', 'role_name' => 'getRoleName', 'is_active' => 'getIsActive', 'must_change_password' => 'getMustChangePassword' ]; /** * 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('username', $data ?? [], null); $this->setIfExists('employee_id', $data ?? [], null); $this->setIfExists('role_name', $data ?? [], null); $this->setIfExists('is_active', $data ?? [], null); $this->setIfExists('must_change_password', $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 username * * @return string|null */ public function getUsername() { return $this->container['username']; } /** * Sets username * * @param string|null $username username * * @return self */ public function setUsername($username) { if (is_null($username)) { array_push($this->openAPINullablesSetToNull, 'username'); } else { $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); $index = array_search('username', $nullablesSetToNull); if ($index !== FALSE) { unset($nullablesSetToNull[$index]); $this->setOpenAPINullablesSetToNull($nullablesSetToNull); } } $this->container['username'] = $username; 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)) { array_push($this->openAPINullablesSetToNull, 'employee_id'); } else { $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); $index = array_search('employee_id', $nullablesSetToNull); if ($index !== FALSE) { unset($nullablesSetToNull[$index]); $this->setOpenAPINullablesSetToNull($nullablesSetToNull); } } $this->container['employee_id'] = $employee_id; return $this; } /** * Gets role_name * * @return string|null */ public function getRoleName() { return $this->container['role_name']; } /** * Sets role_name * * @param string|null $role_name role_name * * @return self */ public function setRoleName($role_name) { if (is_null($role_name)) { array_push($this->openAPINullablesSetToNull, 'role_name'); } else { $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); $index = array_search('role_name', $nullablesSetToNull); if ($index !== FALSE) { unset($nullablesSetToNull[$index]); $this->setOpenAPINullablesSetToNull($nullablesSetToNull); } } $this->container['role_name'] = $role_name; return $this; } /** * Gets is_active * * @return bool|null */ public function getIsActive() { return $this->container['is_active']; } /** * Sets is_active * * @param bool|null $is_active is_active * * @return self */ public function setIsActive($is_active) { if (is_null($is_active)) { throw new \InvalidArgumentException('non-nullable is_active cannot be null'); } $this->container['is_active'] = $is_active; return $this; } /** * Gets must_change_password * * @return bool|null */ public function getMustChangePassword() { return $this->container['must_change_password']; } /** * Sets must_change_password * * @param bool|null $must_change_password must_change_password * * @return self */ public function setMustChangePassword($must_change_password) { if (is_null($must_change_password)) { throw new \InvalidArgumentException('non-nullable must_change_password cannot be null'); } $this->container['must_change_password'] = $must_change_password; 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)); } }