<?php
/**
 * User
 *
 * PHP version 8.1
 *
 * @category Class
 * @package  Vend
 * @author   OpenAPI Generator team
 * @link     https://openapi-generator.tech
 */

/**
 * API 2026-07
 *
 * Lightspeed Retail (X-Series) API.
 *
 * The version of the OpenAPI document: 2026-07
 * Contact: x-series.api@lightspeedhq.com
 * Generated by: https://openapi-generator.tech
 * Generator version: 7.23.0
 */

/**
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

namespace Vend\Model;

use \ArrayAccess;
use \Vend\ObjectSerializer;

/**
 * User Class Doc Comment
 *
 * @category Class
 * @package  Vend
 * @author   OpenAPI Generator team
 * @link     https://openapi-generator.tech
 * @implements \ArrayAccess<string, mixed>
 */
class User implements ModelInterface, ArrayAccess, \JsonSerializable
{
    public const DISCRIMINATOR = null;

    /**
     * The original name of the model.
     *
     * @var string
     */
    protected static $openAPIModelName = 'User';

    /**
     * Array of property to type mappings. Used for (de)serialization
     *
     * @var string[]
     */
    protected static $openAPITypes = [
        'account_type' => 'string',
        'created_at' => 'string',
        'deleted_at' => 'string',
        'display_name' => 'string',
        'email' => 'string',
        'email_verified_at' => 'string',
        'enabled' => 'bool',
        'enabled_mfa' => '\Vend\Model\UserEnabledMfa',
        'id' => 'string',
        'image_source' => 'string',
        'images' => '\Vend\Model\UserImages',
        'is_primary_user' => 'bool',
        'permissions' => 'string[]',
        'require_password_change' => 'bool',
        'restricted_outlet_id' => 'string',
        'restricted_outlet_ids' => 'string[]',
        'roles' => '\Vend\Model\Role[]',
        'rules' => 'object',
        'seen_at' => 'string',
        'switch_id' => 'string',
        'target_daily' => 'float',
        'target_monthly' => 'float',
        'target_weekly' => 'float',
        'time_until_deletion' => 'string',
        'updated_at' => 'string',
        'username' => 'string',
        'version' => 'int'
    ];

    /**
     * Array of property to format mappings. Used for (de)serialization
     *
     * @var string[]
     * @phpstan-var array<string, string|null>
     * @psalm-var array<string, string|null>
     */
    protected static $openAPIFormats = [
        'account_type' => null,
        'created_at' => null,
        'deleted_at' => null,
        'display_name' => null,
        'email' => 'email',
        'email_verified_at' => null,
        'enabled' => null,
        'enabled_mfa' => null,
        'id' => 'uuid',
        'image_source' => null,
        'images' => null,
        'is_primary_user' => null,
        'permissions' => null,
        'require_password_change' => null,
        'restricted_outlet_id' => null,
        'restricted_outlet_ids' => 'uuid',
        'roles' => null,
        'rules' => null,
        'seen_at' => null,
        'switch_id' => null,
        'target_daily' => null,
        'target_monthly' => null,
        'target_weekly' => null,
        'time_until_deletion' => null,
        'updated_at' => null,
        'username' => null,
        'version' => 'int64'
    ];

    /**
     * Array of nullable properties. Used for (de)serialization
     *
     * @var boolean[]
     */
    protected static array $openAPINullables = [
        'account_type' => false,
        'created_at' => false,
        'deleted_at' => true,
        'display_name' => false,
        'email' => false,
        'email_verified_at' => true,
        'enabled' => false,
        'enabled_mfa' => true,
        'id' => false,
        'image_source' => false,
        'images' => false,
        'is_primary_user' => false,
        'permissions' => false,
        'require_password_change' => false,
        'restricted_outlet_id' => true,
        'restricted_outlet_ids' => false,
        'roles' => false,
        'rules' => false,
        'seen_at' => false,
        'switch_id' => false,
        'target_daily' => false,
        'target_monthly' => false,
        'target_weekly' => false,
        'time_until_deletion' => true,
        'updated_at' => false,
        'username' => false,
        'version' => 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 = [
        'account_type' => 'account_type',
        'created_at' => 'created_at',
        'deleted_at' => 'deleted_at',
        'display_name' => 'display_name',
        'email' => 'email',
        'email_verified_at' => 'email_verified_at',
        'enabled' => 'enabled',
        'enabled_mfa' => 'enabled_mfa',
        'id' => 'id',
        'image_source' => 'image_source',
        'images' => 'images',
        'is_primary_user' => 'is_primary_user',
        'permissions' => 'permissions',
        'require_password_change' => 'require_password_change',
        'restricted_outlet_id' => 'restricted_outlet_id',
        'restricted_outlet_ids' => 'restricted_outlet_ids',
        'roles' => 'roles',
        'rules' => 'rules',
        'seen_at' => 'seen_at',
        'switch_id' => 'switch_id',
        'target_daily' => 'target_daily',
        'target_monthly' => 'target_monthly',
        'target_weekly' => 'target_weekly',
        'time_until_deletion' => 'time_until_deletion',
        'updated_at' => 'updated_at',
        'username' => 'username',
        'version' => 'version'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'account_type' => 'setAccountType',
        'created_at' => 'setCreatedAt',
        'deleted_at' => 'setDeletedAt',
        'display_name' => 'setDisplayName',
        'email' => 'setEmail',
        'email_verified_at' => 'setEmailVerifiedAt',
        'enabled' => 'setEnabled',
        'enabled_mfa' => 'setEnabledMfa',
        'id' => 'setId',
        'image_source' => 'setImageSource',
        'images' => 'setImages',
        'is_primary_user' => 'setIsPrimaryUser',
        'permissions' => 'setPermissions',
        'require_password_change' => 'setRequirePasswordChange',
        'restricted_outlet_id' => 'setRestrictedOutletId',
        'restricted_outlet_ids' => 'setRestrictedOutletIds',
        'roles' => 'setRoles',
        'rules' => 'setRules',
        'seen_at' => 'setSeenAt',
        'switch_id' => 'setSwitchId',
        'target_daily' => 'setTargetDaily',
        'target_monthly' => 'setTargetMonthly',
        'target_weekly' => 'setTargetWeekly',
        'time_until_deletion' => 'setTimeUntilDeletion',
        'updated_at' => 'setUpdatedAt',
        'username' => 'setUsername',
        'version' => 'setVersion'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'account_type' => 'getAccountType',
        'created_at' => 'getCreatedAt',
        'deleted_at' => 'getDeletedAt',
        'display_name' => 'getDisplayName',
        'email' => 'getEmail',
        'email_verified_at' => 'getEmailVerifiedAt',
        'enabled' => 'getEnabled',
        'enabled_mfa' => 'getEnabledMfa',
        'id' => 'getId',
        'image_source' => 'getImageSource',
        'images' => 'getImages',
        'is_primary_user' => 'getIsPrimaryUser',
        'permissions' => 'getPermissions',
        'require_password_change' => 'getRequirePasswordChange',
        'restricted_outlet_id' => 'getRestrictedOutletId',
        'restricted_outlet_ids' => 'getRestrictedOutletIds',
        'roles' => 'getRoles',
        'rules' => 'getRules',
        'seen_at' => 'getSeenAt',
        'switch_id' => 'getSwitchId',
        'target_daily' => 'getTargetDaily',
        'target_monthly' => 'getTargetMonthly',
        'target_weekly' => 'getTargetWeekly',
        'time_until_deletion' => 'getTimeUntilDeletion',
        'updated_at' => 'getUpdatedAt',
        'username' => 'getUsername',
        'version' => 'getVersion'
    ];

    /**
     * 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;
    }

    public const ACCOUNT_TYPE_CASHIER = 'cashier';
    public const ACCOUNT_TYPE_MANAGER = 'manager';
    public const ACCOUNT_TYPE_ADMIN = 'admin';

    /**
     * Gets allowable values of the enum
     *
     * @return string[]
     */
    public function getAccountTypeAllowableValues()
    {
        return [
            self::ACCOUNT_TYPE_CASHIER,
            self::ACCOUNT_TYPE_MANAGER,
            self::ACCOUNT_TYPE_ADMIN,
        ];
    }

    /**
     * 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('account_type', $data ?? [], null);
        $this->setIfExists('created_at', $data ?? [], null);
        $this->setIfExists('deleted_at', $data ?? [], null);
        $this->setIfExists('display_name', $data ?? [], null);
        $this->setIfExists('email', $data ?? [], null);
        $this->setIfExists('email_verified_at', $data ?? [], null);
        $this->setIfExists('enabled', $data ?? [], null);
        $this->setIfExists('enabled_mfa', $data ?? [], null);
        $this->setIfExists('id', $data ?? [], null);
        $this->setIfExists('image_source', $data ?? [], null);
        $this->setIfExists('images', $data ?? [], null);
        $this->setIfExists('is_primary_user', $data ?? [], null);
        $this->setIfExists('permissions', $data ?? [], null);
        $this->setIfExists('require_password_change', $data ?? [], null);
        $this->setIfExists('restricted_outlet_id', $data ?? [], null);
        $this->setIfExists('restricted_outlet_ids', $data ?? [], null);
        $this->setIfExists('roles', $data ?? [], null);
        $this->setIfExists('rules', $data ?? [], null);
        $this->setIfExists('seen_at', $data ?? [], null);
        $this->setIfExists('switch_id', $data ?? [], null);
        $this->setIfExists('target_daily', $data ?? [], null);
        $this->setIfExists('target_monthly', $data ?? [], null);
        $this->setIfExists('target_weekly', $data ?? [], null);
        $this->setIfExists('time_until_deletion', $data ?? [], null);
        $this->setIfExists('updated_at', $data ?? [], null);
        $this->setIfExists('username', $data ?? [], null);
        $this->setIfExists('version', $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 = [];

        if ($this->container['account_type'] === null) {
            $invalidProperties[] = "'account_type' can't be null";
        }
        $allowedValues = $this->getAccountTypeAllowableValues();
        if (!is_null($this->container['account_type']) && !in_array($this->container['account_type'], $allowedValues, true)) {
            $invalidProperties[] = sprintf(
                "invalid value '%s' for 'account_type', must be one of '%s'",
                $this->container['account_type'],
                implode("', '", $allowedValues)
            );
        }

        if ($this->container['created_at'] === null) {
            $invalidProperties[] = "'created_at' can't be null";
        }
        if ($this->container['id'] === null) {
            $invalidProperties[] = "'id' can't be null";
        }
        if ($this->container['is_primary_user'] === null) {
            $invalidProperties[] = "'is_primary_user' can't be null";
        }
        if ($this->container['updated_at'] === null) {
            $invalidProperties[] = "'updated_at' can't be null";
        }
        if ($this->container['username'] === null) {
            $invalidProperties[] = "'username' can't be null";
        }
        if ($this->container['version'] === null) {
            $invalidProperties[] = "'version' can't be null";
        }
        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 account_type
     *
     * @return string
     */
    public function getAccountType()
    {
        return $this->container['account_type'];
    }

    /**
     * Sets account_type
     *
     * @param string $account_type User's account type.
     *
     * @return self
     */
    public function setAccountType($account_type)
    {
        if (is_null($account_type)) {
            throw new \InvalidArgumentException('non-nullable account_type cannot be null');
        }
        $allowedValues = $this->getAccountTypeAllowableValues();
        if (!in_array($account_type, $allowedValues, true)) {
            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value '%s' for 'account_type', must be one of '%s'",
                    $account_type,
                    implode("', '", $allowedValues)
                )
            );
        }
        $this->container['account_type'] = $account_type;

        return $this;
    }

    /**
     * Gets created_at
     *
     * @return string
     */
    public function getCreatedAt()
    {
        return $this->container['created_at'];
    }

    /**
     * Sets created_at
     *
     * @param string $created_at Creation timestamp in UTC.
     *
     * @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;
    }

    /**
     * Gets deleted_at
     *
     * @return string|null
     */
    public function getDeletedAt()
    {
        return $this->container['deleted_at'];
    }

    /**
     * Sets deleted_at
     *
     * @param string|null $deleted_at Deletion timestamp in UTC.
     *
     * @return self
     */
    public function setDeletedAt($deleted_at)
    {
        if (is_null($deleted_at)) {
            array_push($this->openAPINullablesSetToNull, 'deleted_at');
        } else {
            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
            $index = array_search('deleted_at', $nullablesSetToNull);
            if ($index !== FALSE) {
                unset($nullablesSetToNull[$index]);
                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
            }
        }
        $this->container['deleted_at'] = $deleted_at;

        return $this;
    }

    /**
     * Gets display_name
     *
     * @return string|null
     */
    public function getDisplayName()
    {
        return $this->container['display_name'];
    }

    /**
     * Sets display_name
     *
     * @param string|null $display_name Full user's name to be used for display in the UI.
     *
     * @return self
     */
    public function setDisplayName($display_name)
    {
        if (is_null($display_name)) {
            throw new \InvalidArgumentException('non-nullable display_name cannot be null');
        }
        $this->container['display_name'] = $display_name;

        return $this;
    }

    /**
     * Gets email
     *
     * @return string|null
     */
    public function getEmail()
    {
        return $this->container['email'];
    }

    /**
     * Sets email
     *
     * @param string|null $email User's email address.
     *
     * @return self
     */
    public function setEmail($email)
    {
        if (is_null($email)) {
            throw new \InvalidArgumentException('non-nullable email cannot be null');
        }
        $this->container['email'] = $email;

        return $this;
    }

    /**
     * Gets email_verified_at
     *
     * @return string|null
     */
    public function getEmailVerifiedAt()
    {
        return $this->container['email_verified_at'];
    }

    /**
     * Sets email_verified_at
     *
     * @param string|null $email_verified_at The timestamp of users email verification.
     *
     * @return self
     */
    public function setEmailVerifiedAt($email_verified_at)
    {
        if (is_null($email_verified_at)) {
            array_push($this->openAPINullablesSetToNull, 'email_verified_at');
        } else {
            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
            $index = array_search('email_verified_at', $nullablesSetToNull);
            if ($index !== FALSE) {
                unset($nullablesSetToNull[$index]);
                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
            }
        }
        $this->container['email_verified_at'] = $email_verified_at;

        return $this;
    }

    /**
     * Gets enabled
     *
     * @return bool|null
     */
    public function getEnabled()
    {
        return $this->container['enabled'];
    }

    /**
     * Sets enabled
     *
     * @param bool|null $enabled Indicates whether the user is enabled.
     *
     * @return self
     */
    public function setEnabled($enabled)
    {
        if (is_null($enabled)) {
            throw new \InvalidArgumentException('non-nullable enabled cannot be null');
        }
        $this->container['enabled'] = $enabled;

        return $this;
    }

    /**
     * Gets enabled_mfa
     *
     * @return \Vend\Model\UserEnabledMfa|null
     */
    public function getEnabledMfa()
    {
        return $this->container['enabled_mfa'];
    }

    /**
     * Sets enabled_mfa
     *
     * @param \Vend\Model\UserEnabledMfa|null $enabled_mfa enabled_mfa
     *
     * @return self
     */
    public function setEnabledMfa($enabled_mfa)
    {
        if (is_null($enabled_mfa)) {
            array_push($this->openAPINullablesSetToNull, 'enabled_mfa');
        } else {
            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
            $index = array_search('enabled_mfa', $nullablesSetToNull);
            if ($index !== FALSE) {
                unset($nullablesSetToNull[$index]);
                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
            }
        }
        $this->container['enabled_mfa'] = $enabled_mfa;

        return $this;
    }

    /**
     * Gets id
     *
     * @return string
     */
    public function getId()
    {
        return $this->container['id'];
    }

    /**
     * Sets id
     *
     * @param string $id Auto-generated object 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 image_source
     *
     * @return string|null
     */
    public function getImageSource()
    {
        return $this->container['image_source'];
    }

    /**
     * Sets image_source
     *
     * @param string|null $image_source URL of the default-sized user's avatar.
     *
     * @return self
     */
    public function setImageSource($image_source)
    {
        if (is_null($image_source)) {
            throw new \InvalidArgumentException('non-nullable image_source cannot be null');
        }
        $this->container['image_source'] = $image_source;

        return $this;
    }

    /**
     * Gets images
     *
     * @return \Vend\Model\UserImages|null
     */
    public function getImages()
    {
        return $this->container['images'];
    }

    /**
     * Sets images
     *
     * @param \Vend\Model\UserImages|null $images images
     *
     * @return self
     */
    public function setImages($images)
    {
        if (is_null($images)) {
            throw new \InvalidArgumentException('non-nullable images cannot be null');
        }
        $this->container['images'] = $images;

        return $this;
    }

    /**
     * Gets is_primary_user
     *
     * @return bool
     */
    public function getIsPrimaryUser()
    {
        return $this->container['is_primary_user'];
    }

    /**
     * Sets is_primary_user
     *
     * @param bool $is_primary_user Indicated whether this user is the primary user for the account.
     *
     * @return self
     */
    public function setIsPrimaryUser($is_primary_user)
    {
        if (is_null($is_primary_user)) {
            throw new \InvalidArgumentException('non-nullable is_primary_user cannot be null');
        }
        $this->container['is_primary_user'] = $is_primary_user;

        return $this;
    }

    /**
     * Gets permissions
     *
     * @return string[]|null
     */
    public function getPermissions()
    {
        return $this->container['permissions'];
    }

    /**
     * Sets permissions
     *
     * @param string[]|null $permissions The permissions assigned to the user.
     *
     * @return self
     */
    public function setPermissions($permissions)
    {
        if (is_null($permissions)) {
            throw new \InvalidArgumentException('non-nullable permissions cannot be null');
        }
        $this->container['permissions'] = $permissions;

        return $this;
    }

    /**
     * Gets require_password_change
     *
     * @return bool|null
     */
    public function getRequirePasswordChange()
    {
        return $this->container['require_password_change'];
    }

    /**
     * Sets require_password_change
     *
     * @param bool|null $require_password_change Indicates whether the user is required to change their password.
     *
     * @return self
     */
    public function setRequirePasswordChange($require_password_change)
    {
        if (is_null($require_password_change)) {
            throw new \InvalidArgumentException('non-nullable require_password_change cannot be null');
        }
        $this->container['require_password_change'] = $require_password_change;

        return $this;
    }

    /**
     * Gets restricted_outlet_id
     *
     * @return string|null
     * @deprecated
     */
    public function getRestrictedOutletId()
    {
        return $this->container['restricted_outlet_id'];
    }

    /**
     * Sets restricted_outlet_id
     *
     * @param string|null $restricted_outlet_id **deprecated** Use the `restricted_outlet_ids` instead.
     *
     * @return self
     * @deprecated
     */
    public function setRestrictedOutletId($restricted_outlet_id)
    {
        if (is_null($restricted_outlet_id)) {
            array_push($this->openAPINullablesSetToNull, 'restricted_outlet_id');
        } else {
            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
            $index = array_search('restricted_outlet_id', $nullablesSetToNull);
            if ($index !== FALSE) {
                unset($nullablesSetToNull[$index]);
                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
            }
        }
        $this->container['restricted_outlet_id'] = $restricted_outlet_id;

        return $this;
    }

    /**
     * Gets restricted_outlet_ids
     *
     * @return string[]|null
     */
    public function getRestrictedOutletIds()
    {
        return $this->container['restricted_outlet_ids'];
    }

    /**
     * Sets restricted_outlet_ids
     *
     * @param string[]|null $restricted_outlet_ids A list of outlet IDs the user is associated with
     *
     * @return self
     */
    public function setRestrictedOutletIds($restricted_outlet_ids)
    {
        if (is_null($restricted_outlet_ids)) {
            throw new \InvalidArgumentException('non-nullable restricted_outlet_ids cannot be null');
        }
        $this->container['restricted_outlet_ids'] = $restricted_outlet_ids;

        return $this;
    }

    /**
     * Gets roles
     *
     * @return \Vend\Model\Role[]|null
     */
    public function getRoles()
    {
        return $this->container['roles'];
    }

    /**
     * Sets roles
     *
     * @param \Vend\Model\Role[]|null $roles The roles assigned to the user.
     *
     * @return self
     */
    public function setRoles($roles)
    {
        if (is_null($roles)) {
            throw new \InvalidArgumentException('non-nullable roles cannot be null');
        }
        $this->container['roles'] = $roles;

        return $this;
    }

    /**
     * Gets rules
     *
     * @return object|null
     */
    public function getRules()
    {
        return $this->container['rules'];
    }

    /**
     * Sets rules
     *
     * @param object|null $rules The rules assigned to the user.
     *
     * @return self
     */
    public function setRules($rules)
    {
        if (is_null($rules)) {
            throw new \InvalidArgumentException('non-nullable rules cannot be null');
        }
        $this->container['rules'] = $rules;

        return $this;
    }

    /**
     * Gets seen_at
     *
     * @return string|null
     */
    public function getSeenAt()
    {
        return $this->container['seen_at'];
    }

    /**
     * Sets seen_at
     *
     * @param string|null $seen_at The timestamp of the user's last activity in the system.
     *
     * @return self
     */
    public function setSeenAt($seen_at)
    {
        if (is_null($seen_at)) {
            throw new \InvalidArgumentException('non-nullable seen_at cannot be null');
        }
        $this->container['seen_at'] = $seen_at;

        return $this;
    }

    /**
     * Gets switch_id
     *
     * @return string|null
     */
    public function getSwitchId()
    {
        return $this->container['switch_id'];
    }

    /**
     * Sets switch_id
     *
     * @param string|null $switch_id The switch id for the user.
     *
     * @return self
     */
    public function setSwitchId($switch_id)
    {
        if (is_null($switch_id)) {
            throw new \InvalidArgumentException('non-nullable switch_id cannot be null');
        }
        $this->container['switch_id'] = $switch_id;

        return $this;
    }

    /**
     * Gets target_daily
     *
     * @return float|null
     */
    public function getTargetDaily()
    {
        return $this->container['target_daily'];
    }

    /**
     * Sets target_daily
     *
     * @param float|null $target_daily Daily sales target for the user.
     *
     * @return self
     */
    public function setTargetDaily($target_daily)
    {
        if (is_null($target_daily)) {
            throw new \InvalidArgumentException('non-nullable target_daily cannot be null');
        }
        $this->container['target_daily'] = $target_daily;

        return $this;
    }

    /**
     * Gets target_monthly
     *
     * @return float|null
     */
    public function getTargetMonthly()
    {
        return $this->container['target_monthly'];
    }

    /**
     * Sets target_monthly
     *
     * @param float|null $target_monthly Monthly sales target for the user.
     *
     * @return self
     */
    public function setTargetMonthly($target_monthly)
    {
        if (is_null($target_monthly)) {
            throw new \InvalidArgumentException('non-nullable target_monthly cannot be null');
        }
        $this->container['target_monthly'] = $target_monthly;

        return $this;
    }

    /**
     * Gets target_weekly
     *
     * @return float|null
     */
    public function getTargetWeekly()
    {
        return $this->container['target_weekly'];
    }

    /**
     * Sets target_weekly
     *
     * @param float|null $target_weekly Weekly sales target for the user.
     *
     * @return self
     */
    public function setTargetWeekly($target_weekly)
    {
        if (is_null($target_weekly)) {
            throw new \InvalidArgumentException('non-nullable target_weekly cannot be null');
        }
        $this->container['target_weekly'] = $target_weekly;

        return $this;
    }

    /**
     * Gets time_until_deletion
     *
     * @return string|null
     */
    public function getTimeUntilDeletion()
    {
        return $this->container['time_until_deletion'];
    }

    /**
     * Sets time_until_deletion
     *
     * @param string|null $time_until_deletion The time until the user is deleted.
     *
     * @return self
     */
    public function setTimeUntilDeletion($time_until_deletion)
    {
        if (is_null($time_until_deletion)) {
            array_push($this->openAPINullablesSetToNull, 'time_until_deletion');
        } else {
            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
            $index = array_search('time_until_deletion', $nullablesSetToNull);
            if ($index !== FALSE) {
                unset($nullablesSetToNull[$index]);
                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
            }
        }
        $this->container['time_until_deletion'] = $time_until_deletion;

        return $this;
    }

    /**
     * Gets updated_at
     *
     * @return string
     */
    public function getUpdatedAt()
    {
        return $this->container['updated_at'];
    }

    /**
     * Sets updated_at
     *
     * @param string $updated_at Last update timestamp in UTC.
     *
     * @return self
     */
    public function setUpdatedAt($updated_at)
    {
        if (is_null($updated_at)) {
            throw new \InvalidArgumentException('non-nullable updated_at cannot be null');
        }
        $this->container['updated_at'] = $updated_at;

        return $this;
    }

    /**
     * Gets username
     *
     * @return string
     */
    public function getUsername()
    {
        return $this->container['username'];
    }

    /**
     * Sets username
     *
     * @param string $username User's username used for login.
     *
     * @return self
     */
    public function setUsername($username)
    {
        if (is_null($username)) {
            throw new \InvalidArgumentException('non-nullable username cannot be null');
        }
        $this->container['username'] = $username;

        return $this;
    }

    /**
     * Gets version
     *
     * @return int
     */
    public function getVersion()
    {
        return $this->container['version'];
    }

    /**
     * Sets version
     *
     * @param int $version Auto-incrementing object version number.
     *
     * @return self
     */
    public function setVersion($version)
    {
        if (is_null($version)) {
            throw new \InvalidArgumentException('non-nullable version cannot be null');
        }
        $this->container['version'] = $version;

        return $this;
    }
    /**
     * Returns true if offset exists. False otherwise.
     *
     * @param integer|string $offset Offset
     *
     * @return boolean
     */
    public function offsetExists(mixed $offset): bool
    {
        return isset($this->container[$offset]);
    }

    /**
     * Gets offset.
     *
     * @param integer|string $offset Offset
     *
     * @return mixed|null
     */
    #[\ReturnTypeWillChange]
    public function offsetGet(mixed $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|string $offset Offset
     *
     * @return void
     */
    public function offsetUnset(mixed $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));
    }
}


