<?php
/**
 * ClerkWithStores
 *
 * PHP version 7.4
 *
 * @category Class
 * @package  SmartVolution
 * @author   OpenAPI Generator team
 * @link     https://openapi-generator.tech
 */

/**
 * SV Register Web-services
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 4.15
 * Generated by: https://openapi-generator.tech
 * OpenAPI Generator version: 6.0.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 SmartVolution\Model;

use \ArrayAccess;
use \SmartVolution\ObjectSerializer;

/**
 * ClerkWithStores Class Doc Comment
 *
 * @category Class
 * @package  SmartVolution
 * @author   OpenAPI Generator team
 * @link     https://openapi-generator.tech
 * @implements \ArrayAccess<TKey, TValue>
 * @template TKey int|null
 * @template TValue mixed|null
 */
class ClerkWithStores implements ModelInterface, ArrayAccess, \JsonSerializable
{
    public const DISCRIMINATOR = null;

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

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $openAPITypes = [
        'id' => 'int',
        'firstName' => 'string',
        'lastName' => 'string',
        'modified' => 'int',
        'password' => 'string',
        'login' => 'string',
        'supervisor' => 'bool',
        'deleted' => 'bool',
        'tenant' => 'int',
        'commissionRate' => 'double',
        'allowAppointments' => 'bool',
        'clerkType' => 'string',
        'stores' => '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 = [
        'id' => 'int64',
        'firstName' => null,
        'lastName' => null,
        'modified' => 'int64',
        'password' => null,
        'login' => null,
        'supervisor' => null,
        'deleted' => null,
        'tenant' => 'int64',
        'commissionRate' => 'double',
        'allowAppointments' => null,
        'clerkType' => null,
        'stores' => 'int64'
    ];

    /**
     * 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 attributes where the key is the local name,
     * and the value is the original name
     *
     * @var string[]
     */
    protected static $attributeMap = [
        'id' => 'id',
        'firstName' => 'firstName',
        'lastName' => 'lastName',
        'modified' => 'modified',
        'password' => 'password',
        'login' => 'login',
        'supervisor' => 'supervisor',
        'deleted' => 'deleted',
        'tenant' => 'tenant',
        'commissionRate' => 'commissionRate',
        'allowAppointments' => 'allowAppointments',
        'clerkType' => 'clerkType',
        'stores' => 'stores'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'id' => 'setId',
        'firstName' => 'setFirstName',
        'lastName' => 'setLastName',
        'modified' => 'setModified',
        'password' => 'setPassword',
        'login' => 'setLogin',
        'supervisor' => 'setSupervisor',
        'deleted' => 'setDeleted',
        'tenant' => 'setTenant',
        'commissionRate' => 'setCommissionRate',
        'allowAppointments' => 'setAllowAppointments',
        'clerkType' => 'setClerkType',
        'stores' => 'setStores'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'id' => 'getId',
        'firstName' => 'getFirstName',
        'lastName' => 'getLastName',
        'modified' => 'getModified',
        'password' => 'getPassword',
        'login' => 'getLogin',
        'supervisor' => 'getSupervisor',
        'deleted' => 'getDeleted',
        'tenant' => 'getTenant',
        'commissionRate' => 'getCommissionRate',
        'allowAppointments' => 'getAllowAppointments',
        'clerkType' => 'getClerkType',
        'stores' => 'getStores'
    ];

    /**
     * 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[] $data Associated array of property values
     *                      initializing the model
     */
    public function __construct(array $data = null)
    {
        $this->container['id'] = $data['id'] ?? null;
        $this->container['firstName'] = $data['firstName'] ?? null;
        $this->container['lastName'] = $data['lastName'] ?? null;
        $this->container['modified'] = $data['modified'] ?? null;
        $this->container['password'] = $data['password'] ?? null;
        $this->container['login'] = $data['login'] ?? null;
        $this->container['supervisor'] = $data['supervisor'] ?? null;
        $this->container['deleted'] = $data['deleted'] ?? null;
        $this->container['tenant'] = $data['tenant'] ?? null;
        $this->container['commissionRate'] = $data['commissionRate'] ?? null;
        $this->container['allowAppointments'] = $data['allowAppointments'] ?? null;
        $this->container['clerkType'] = $data['clerkType'] ?? null;
        $this->container['stores'] = $data['stores'] ?? null;
    }

    /**
     * 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 int|null
     */
    public function getId()
    {
        return $this->container['id'];
    }

    /**
     * Sets id
     *
     * @param int|null $id clerk unique id
     *
     * @return self
     */
    public function setId($id)
    {
        $this->container['id'] = $id;

        return $this;
    }

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

    /**
     * Sets firstName
     *
     * @param string|null $firstName First Name of Clerk
     *
     * @return self
     */
    public function setFirstName($firstName)
    {
        $this->container['firstName'] = $firstName;

        return $this;
    }

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

    /**
     * Sets lastName
     *
     * @param string|null $lastName Last Name of Clerk
     *
     * @return self
     */
    public function setLastName($lastName)
    {
        $this->container['lastName'] = $lastName;

        return $this;
    }

    /**
     * Gets modified
     *
     * @return int|null
     */
    public function getModified()
    {
        return $this->container['modified'];
    }

    /**
     * Sets modified
     *
     * @param int|null $modified The time in seconds since midnight January 1st 1970 UTC that this Clerk was modified
     *
     * @return self
     */
    public function setModified($modified)
    {
        $this->container['modified'] = $modified;

        return $this;
    }

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

    /**
     * Sets password
     *
     * @param string|null $password The Clerks password
     *
     * @return self
     */
    public function setPassword($password)
    {
        $this->container['password'] = $password;

        return $this;
    }

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

    /**
     * Sets login
     *
     * @param string|null $login the username for the clerk
     *
     * @return self
     */
    public function setLogin($login)
    {
        $this->container['login'] = $login;

        return $this;
    }

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

    /**
     * Sets supervisor
     *
     * @param bool|null $supervisor flag representing if the clerk is a supervisor
     *
     * @return self
     */
    public function setSupervisor($supervisor)
    {
        $this->container['supervisor'] = $supervisor;

        return $this;
    }

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

    /**
     * Sets deleted
     *
     * @param bool|null $deleted flag representing if the clerk has been deleted
     *
     * @return self
     */
    public function setDeleted($deleted)
    {
        $this->container['deleted'] = $deleted;

        return $this;
    }

    /**
     * Gets tenant
     *
     * @return int|null
     */
    public function getTenant()
    {
        return $this->container['tenant'];
    }

    /**
     * Sets tenant
     *
     * @param int|null $tenant The Id of the tenant the clerk should be added to
     *
     * @return self
     */
    public function setTenant($tenant)
    {
        $this->container['tenant'] = $tenant;

        return $this;
    }

    /**
     * Gets commissionRate
     *
     * @return double|null
     */
    public function getCommissionRate()
    {
        return $this->container['commissionRate'];
    }

    /**
     * Sets commissionRate
     *
     * @param double|null $commissionRate the commisssionRate of Clerk
     *
     * @return self
     */
    public function setCommissionRate($commissionRate)
    {
        $this->container['commissionRate'] = $commissionRate;

        return $this;
    }

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

    /**
     * Sets allowAppointments
     *
     * @param bool|null $allowAppointments flag representing if the clerk allow Appointments
     *
     * @return self
     */
    public function setAllowAppointments($allowAppointments)
    {
        $this->container['allowAppointments'] = $allowAppointments;

        return $this;
    }

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

    /**
     * Sets clerkType
     *
     * @param string|null $clerkType the type of the clerk
     *
     * @return self
     */
    public function setClerkType($clerkType)
    {
        $this->container['clerkType'] = $clerkType;

        return $this;
    }

    /**
     * Gets stores
     *
     * @return int[]|null
     */
    public function getStores()
    {
        return $this->container['stores'];
    }

    /**
     * Sets stores
     *
     * @param int[]|null $stores List of store Ids to assign to clerk
     *
     * @return self
     */
    public function setStores($stores)
    {
        $this->container['stores'] = $stores;

        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));
    }
}


