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

/**
 * Lightspeed Retail (R-Series) API
 *
 * API for Lightspeed Retail POS system. This specification covers the R-Series API endpoints.  NOTE: This is an abridged version of the R-Series API Documentation. For more detailed documentation, visit [API Developer Documentation](https://developers.lightspeedhq.com/retail/)
 *
 * The version of the OpenAPI document: 3.0.0
 * Generated by: https://openapi-generator.tech
 * Generator version: 7.19.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 LightspeedV3\Model;

use \ArrayAccess;
use \LightspeedV3\ObjectSerializer;

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

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

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $openAPITypes = [
        'employee_id' => 'int',
        'first_name' => 'string',
        'last_name' => 'string',
        'lock_out' => 'bool',
        'archived' => 'bool',
        'contact_id' => 'int',
        'clock_in_employee_hours_id' => 'int',
        'employee_role_id' => 'int',
        'limit_to_shop_id' => 'int',
        'last_shop_id' => 'int',
        'last_sale_id' => 'int',
        'last_register_id' => 'int',
        'time_stamp' => '\DateTime',
        'contact' => '\LightspeedV3\Model\Contact',
        'employee_role' => '\LightspeedV3\Model\EmployeeRole'
    ];

    /**
      * 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 = [
        'employee_id' => null,
        'first_name' => null,
        'last_name' => null,
        'lock_out' => null,
        'archived' => null,
        'contact_id' => null,
        'clock_in_employee_hours_id' => null,
        'employee_role_id' => null,
        'limit_to_shop_id' => null,
        'last_shop_id' => null,
        'last_sale_id' => null,
        'last_register_id' => null,
        'time_stamp' => 'date-time',
        'contact' => null,
        'employee_role' => null
    ];

    /**
      * Array of nullable properties. Used for (de)serialization
      *
      * @var boolean[]
      */
    protected static array $openAPINullables = [
        'employee_id' => false,
        'first_name' => false,
        'last_name' => false,
        'lock_out' => false,
        'archived' => false,
        'contact_id' => false,
        'clock_in_employee_hours_id' => false,
        'employee_role_id' => false,
        'limit_to_shop_id' => false,
        'last_shop_id' => false,
        'last_sale_id' => false,
        'last_register_id' => false,
        'time_stamp' => false,
        'contact' => false,
        'employee_role' => 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 = [
        'employee_id' => 'employeeID',
        'first_name' => 'firstName',
        'last_name' => 'lastName',
        'lock_out' => 'lockOut',
        'archived' => 'archived',
        'contact_id' => 'contactID',
        'clock_in_employee_hours_id' => 'clockInEmployeeHoursID',
        'employee_role_id' => 'employeeRoleID',
        'limit_to_shop_id' => 'limitToShopID',
        'last_shop_id' => 'lastShopID',
        'last_sale_id' => 'lastSaleID',
        'last_register_id' => 'lastRegisterID',
        'time_stamp' => 'timeStamp',
        'contact' => 'Contact',
        'employee_role' => 'EmployeeRole'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'employee_id' => 'setEmployeeId',
        'first_name' => 'setFirstName',
        'last_name' => 'setLastName',
        'lock_out' => 'setLockOut',
        'archived' => 'setArchived',
        'contact_id' => 'setContactId',
        'clock_in_employee_hours_id' => 'setClockInEmployeeHoursId',
        'employee_role_id' => 'setEmployeeRoleId',
        'limit_to_shop_id' => 'setLimitToShopId',
        'last_shop_id' => 'setLastShopId',
        'last_sale_id' => 'setLastSaleId',
        'last_register_id' => 'setLastRegisterId',
        'time_stamp' => 'setTimeStamp',
        'contact' => 'setContact',
        'employee_role' => 'setEmployeeRole'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'employee_id' => 'getEmployeeId',
        'first_name' => 'getFirstName',
        'last_name' => 'getLastName',
        'lock_out' => 'getLockOut',
        'archived' => 'getArchived',
        'contact_id' => 'getContactId',
        'clock_in_employee_hours_id' => 'getClockInEmployeeHoursId',
        'employee_role_id' => 'getEmployeeRoleId',
        'limit_to_shop_id' => 'getLimitToShopId',
        'last_shop_id' => 'getLastShopId',
        'last_sale_id' => 'getLastSaleId',
        'last_register_id' => 'getLastRegisterId',
        'time_stamp' => 'getTimeStamp',
        'contact' => 'getContact',
        'employee_role' => 'getEmployeeRole'
    ];

    /**
     * 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('employee_id', $data ?? [], null);
        $this->setIfExists('first_name', $data ?? [], null);
        $this->setIfExists('last_name', $data ?? [], null);
        $this->setIfExists('lock_out', $data ?? [], false);
        $this->setIfExists('archived', $data ?? [], false);
        $this->setIfExists('contact_id', $data ?? [], null);
        $this->setIfExists('clock_in_employee_hours_id', $data ?? [], null);
        $this->setIfExists('employee_role_id', $data ?? [], null);
        $this->setIfExists('limit_to_shop_id', $data ?? [], null);
        $this->setIfExists('last_shop_id', $data ?? [], null);
        $this->setIfExists('last_sale_id', $data ?? [], null);
        $this->setIfExists('last_register_id', $data ?? [], null);
        $this->setIfExists('time_stamp', $data ?? [], null);
        $this->setIfExists('contact', $data ?? [], null);
        $this->setIfExists('employee_role', $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['employee_id'] === null) {
            $invalidProperties[] = "'employee_id' can't be null";
        }
        if ($this->container['first_name'] === null) {
            $invalidProperties[] = "'first_name' can't be null";
        }
        if ($this->container['last_name'] === null) {
            $invalidProperties[] = "'last_name' 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 employee_id
     *
     * @return int
     */
    public function getEmployeeId()
    {
        return $this->container['employee_id'];
    }

    /**
     * Sets employee_id
     *
     * @param int $employee_id Unique employee identifier
     *
     * @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 first_name
     *
     * @return string
     */
    public function getFirstName()
    {
        return $this->container['first_name'];
    }

    /**
     * Sets first_name
     *
     * @param string $first_name Employee first name
     *
     * @return self
     */
    public function setFirstName($first_name)
    {
        if (is_null($first_name)) {
            throw new \InvalidArgumentException('non-nullable first_name cannot be null');
        }
        $this->container['first_name'] = $first_name;

        return $this;
    }

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

    /**
     * Sets last_name
     *
     * @param string $last_name Employee last name
     *
     * @return self
     */
    public function setLastName($last_name)
    {
        if (is_null($last_name)) {
            throw new \InvalidArgumentException('non-nullable last_name cannot be null');
        }
        $this->container['last_name'] = $last_name;

        return $this;
    }

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

    /**
     * Sets lock_out
     *
     * @param bool|null $lock_out Whether employee is locked out
     *
     * @return self
     */
    public function setLockOut($lock_out)
    {
        if (is_null($lock_out)) {
            throw new \InvalidArgumentException('non-nullable lock_out cannot be null');
        }
        $this->container['lock_out'] = $lock_out;

        return $this;
    }

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

    /**
     * Sets archived
     *
     * @param bool|null $archived Whether employee is archived
     *
     * @return self
     */
    public function setArchived($archived)
    {
        if (is_null($archived)) {
            throw new \InvalidArgumentException('non-nullable archived cannot be null');
        }
        $this->container['archived'] = $archived;

        return $this;
    }

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

    /**
     * Sets contact_id
     *
     * @param int|null $contact_id Associated contact ID
     *
     * @return self
     */
    public function setContactId($contact_id)
    {
        if (is_null($contact_id)) {
            throw new \InvalidArgumentException('non-nullable contact_id cannot be null');
        }
        $this->container['contact_id'] = $contact_id;

        return $this;
    }

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

    /**
     * Sets clock_in_employee_hours_id
     *
     * @param int|null $clock_in_employee_hours_id Current clock-in hours record ID
     *
     * @return self
     */
    public function setClockInEmployeeHoursId($clock_in_employee_hours_id)
    {
        if (is_null($clock_in_employee_hours_id)) {
            throw new \InvalidArgumentException('non-nullable clock_in_employee_hours_id cannot be null');
        }
        $this->container['clock_in_employee_hours_id'] = $clock_in_employee_hours_id;

        return $this;
    }

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

    /**
     * Sets employee_role_id
     *
     * @param int|null $employee_role_id Employee role ID
     *
     * @return self
     */
    public function setEmployeeRoleId($employee_role_id)
    {
        if (is_null($employee_role_id)) {
            throw new \InvalidArgumentException('non-nullable employee_role_id cannot be null');
        }
        $this->container['employee_role_id'] = $employee_role_id;

        return $this;
    }

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

    /**
     * Sets limit_to_shop_id
     *
     * @param int|null $limit_to_shop_id Shop restriction ID
     *
     * @return self
     */
    public function setLimitToShopId($limit_to_shop_id)
    {
        if (is_null($limit_to_shop_id)) {
            throw new \InvalidArgumentException('non-nullable limit_to_shop_id cannot be null');
        }
        $this->container['limit_to_shop_id'] = $limit_to_shop_id;

        return $this;
    }

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

    /**
     * Sets last_shop_id
     *
     * @param int|null $last_shop_id Last accessed shop ID
     *
     * @return self
     */
    public function setLastShopId($last_shop_id)
    {
        if (is_null($last_shop_id)) {
            throw new \InvalidArgumentException('non-nullable last_shop_id cannot be null');
        }
        $this->container['last_shop_id'] = $last_shop_id;

        return $this;
    }

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

    /**
     * Sets last_sale_id
     *
     * @param int|null $last_sale_id Last sale ID
     *
     * @return self
     */
    public function setLastSaleId($last_sale_id)
    {
        if (is_null($last_sale_id)) {
            throw new \InvalidArgumentException('non-nullable last_sale_id cannot be null');
        }
        $this->container['last_sale_id'] = $last_sale_id;

        return $this;
    }

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

    /**
     * Sets last_register_id
     *
     * @param int|null $last_register_id Last used register ID
     *
     * @return self
     */
    public function setLastRegisterId($last_register_id)
    {
        if (is_null($last_register_id)) {
            throw new \InvalidArgumentException('non-nullable last_register_id cannot be null');
        }
        $this->container['last_register_id'] = $last_register_id;

        return $this;
    }

    /**
     * Gets time_stamp
     *
     * @return \DateTime|null
     */
    public function getTimeStamp()
    {
        return $this->container['time_stamp'];
    }

    /**
     * Sets time_stamp
     *
     * @param \DateTime|null $time_stamp Last modification timestamp
     *
     * @return self
     */
    public function setTimeStamp($time_stamp)
    {
        if (is_null($time_stamp)) {
            throw new \InvalidArgumentException('non-nullable time_stamp cannot be null');
        }
        $this->container['time_stamp'] = $time_stamp;

        return $this;
    }

    /**
     * Gets contact
     *
     * @return \LightspeedV3\Model\Contact|null
     */
    public function getContact()
    {
        return $this->container['contact'];
    }

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

        return $this;
    }

    /**
     * Gets employee_role
     *
     * @return \LightspeedV3\Model\EmployeeRole|null
     */
    public function getEmployeeRole()
    {
        return $this->container['employee_role'];
    }

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

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


