<?php
/**
 * BaseUserMe
 *
 * PHP version 7.3
 *
 * @category Class
 * @package  Pipedrive
 * @author   OpenAPI Generator team
 * @link     https://openapi-generator.tech
 */

/**
 * Pipedrive API v1
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 1.0.0
 * Generated by: https://openapi-generator.tech
 * OpenAPI Generator version: 5.3.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 Pipedrive\Model;

use ArrayAccess;
use JsonException;
use JsonSerializable;
use Pipedrive\Traits\RawData;
use Pipedrive\ObjectSerializer;

/**
 * BaseUserMe Class Doc Comment
 *
 * @category Class
 * @package  Pipedrive
 * @author   OpenAPI Generator team
 * @link     https://openapi-generator.tech
 * @implements ArrayAccess<TKey, TValue>
 * @template TKey int|null
 * @template TValue mixed|null
 */
class BaseUserMe implements ModelInterface, ArrayAccess, JsonSerializable
{
    use RawData;

    public const DISCRIMINATOR = null;

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

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      * @phpstan-var array<string, string>
      * @phpsalm-var array<string, string>
      */
    protected static array $openAPITypes = [
        'id' => 'int',
        'name' => 'string',
        'default_currency' => 'string',
        'locale' => 'string',
        'lang' => 'int',
        'email' => 'string',
        'phone' => 'string',
        'activated' => 'bool',
        'last_login' => 'string',
        'created' => 'string',
        'modified' => 'string',
        'has_created_company' => 'bool',
        'access' => '\Pipedrive\Model\UserAccess[]',
        'active_flag' => 'bool',
        'timezone_name' => 'string',
        'timezone_offset' => 'string',
        'role_id' => 'int',
        'icon_url' => 'string',
        'is_you' => 'bool',
        'is_deleted' => 'bool',
        'company_id' => 'int',
        'company_name' => 'string',
        'company_domain' => 'string',
        'company_country' => 'string',
        'company_industry' => 'string',
        'language' => '\Pipedrive\Model\BaseUserMeAllOfLanguage'
    ];

    /**
      * 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' => null,
        'name' => null,
        'default_currency' => null,
        'locale' => null,
        'lang' => null,
        'email' => null,
        'phone' => null,
        'activated' => null,
        'last_login' => null,
        'created' => null,
        'modified' => null,
        'has_created_company' => null,
        'access' => null,
        'active_flag' => null,
        'timezone_name' => null,
        'timezone_offset' => null,
        'role_id' => null,
        'icon_url' => null,
        'is_you' => null,
        'is_deleted' => null,
        'company_id' => null,
        'company_name' => null,
        'company_domain' => null,
        'company_country' => null,
        'company_industry' => null,
        'language' => null
    ];

    /**
     * Array of property to type mappings. Used for (de)serialization
     *
     * @phpstan-return array<string, string>
     * @psalm-return array<string, string>
     * @return array
     */
    public static function openAPITypes(): array
    {
        return self::$openAPITypes;
    }

    /**
     * Array of property to format mappings. Used for (de)serialization
     *
     * @phpstan-return array<string, string|null>
     * @psalm-return array<string, string|null>
     * @return array
     */
    public static function openAPIFormats(): array
    {
        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',
        'name' => 'name',
        'default_currency' => 'default_currency',
        'locale' => 'locale',
        'lang' => 'lang',
        'email' => 'email',
        'phone' => 'phone',
        'activated' => 'activated',
        'last_login' => 'last_login',
        'created' => 'created',
        'modified' => 'modified',
        'has_created_company' => 'has_created_company',
        'access' => 'access',
        'active_flag' => 'active_flag',
        'timezone_name' => 'timezone_name',
        'timezone_offset' => 'timezone_offset',
        'role_id' => 'role_id',
        'icon_url' => 'icon_url',
        'is_you' => 'is_you',
        'is_deleted' => 'is_deleted',
        'company_id' => 'company_id',
        'company_name' => 'company_name',
        'company_domain' => 'company_domain',
        'company_country' => 'company_country',
        'company_industry' => 'company_industry',
        'language' => 'language'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'id' => 'setId',
        'name' => 'setName',
        'default_currency' => 'setDefaultCurrency',
        'locale' => 'setLocale',
        'lang' => 'setLang',
        'email' => 'setEmail',
        'phone' => 'setPhone',
        'activated' => 'setActivated',
        'last_login' => 'setLastLogin',
        'created' => 'setCreated',
        'modified' => 'setModified',
        'has_created_company' => 'setHasCreatedCompany',
        'access' => 'setAccess',
        'active_flag' => 'setActiveFlag',
        'timezone_name' => 'setTimezoneName',
        'timezone_offset' => 'setTimezoneOffset',
        'role_id' => 'setRoleId',
        'icon_url' => 'setIconUrl',
        'is_you' => 'setIsYou',
        'is_deleted' => 'setIsDeleted',
        'company_id' => 'setCompanyId',
        'company_name' => 'setCompanyName',
        'company_domain' => 'setCompanyDomain',
        'company_country' => 'setCompanyCountry',
        'company_industry' => 'setCompanyIndustry',
        'language' => 'setLanguage'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'id' => 'getId',
        'name' => 'getName',
        'default_currency' => 'getDefaultCurrency',
        'locale' => 'getLocale',
        'lang' => 'getLang',
        'email' => 'getEmail',
        'phone' => 'getPhone',
        'activated' => 'getActivated',
        'last_login' => 'getLastLogin',
        'created' => 'getCreated',
        'modified' => 'getModified',
        'has_created_company' => 'getHasCreatedCompany',
        'access' => 'getAccess',
        'active_flag' => 'getActiveFlag',
        'timezone_name' => 'getTimezoneName',
        'timezone_offset' => 'getTimezoneOffset',
        'role_id' => 'getRoleId',
        'icon_url' => 'getIconUrl',
        'is_you' => 'getIsYou',
        'is_deleted' => 'getIsDeleted',
        'company_id' => 'getCompanyId',
        'company_name' => 'getCompanyName',
        'company_domain' => 'getCompanyDomain',
        'company_country' => 'getCompanyCountry',
        'company_industry' => 'getCompanyIndustry',
        'language' => 'getLanguage'
    ];

    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name
     *
     * @phpstan-return array<string, string>
     * @psalm-return array<string, string>
     * @return array
     */
    public static function attributeMap(): array
    {
        return self::$attributeMap;
    }

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @phpstan-return array<string, string>
     * @psalm-return array<string, string>
     * @return array
     */
    public static function setters(): array
    {
        return self::$setters;
    }

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @phpstan-return array<string, string>
     * @psalm-return array<string, string>
     * @return array
     */
    public static function getters(): array
    {
        return self::$getters;
    }

    /**
     * The original name of the model.
     *
     * @return string
     */
    public function getModelName(): string
    {
        return self::$openAPIModelName;
    }


    /**
     * Associative array for storing property values
     *
     * @var array
     * @phpstan-var array<int|string, mixed>
     * @psalm-var array<int|string, mixed>
     */
    protected array $container = [];

    /**
     * Constructor
     *
     * @phpstan-param array<string, mixed>|null $data
     * @psalm-param array<string, mixed>|null $data
     * @param array|null $data Associated array of property values
     *                      initializing the model
     */
    public function __construct(array $data = null)
    {
        $this->container['id'] = $data['id'] ?? null;
        $this->container['name'] = $data['name'] ?? null;
        $this->container['default_currency'] = $data['default_currency'] ?? null;
        $this->container['locale'] = $data['locale'] ?? null;
        $this->container['lang'] = $data['lang'] ?? null;
        $this->container['email'] = $data['email'] ?? null;
        $this->container['phone'] = $data['phone'] ?? null;
        $this->container['activated'] = $data['activated'] ?? null;
        $this->container['last_login'] = $data['last_login'] ?? null;
        $this->container['created'] = $data['created'] ?? null;
        $this->container['modified'] = $data['modified'] ?? null;
        $this->container['has_created_company'] = $data['has_created_company'] ?? null;
        $this->container['access'] = $data['access'] ?? null;
        $this->container['active_flag'] = $data['active_flag'] ?? null;
        $this->container['timezone_name'] = $data['timezone_name'] ?? null;
        $this->container['timezone_offset'] = $data['timezone_offset'] ?? null;
        $this->container['role_id'] = $data['role_id'] ?? null;
        $this->container['icon_url'] = $data['icon_url'] ?? null;
        $this->container['is_you'] = $data['is_you'] ?? null;
        $this->container['is_deleted'] = $data['is_deleted'] ?? null;
        $this->container['company_id'] = $data['company_id'] ?? null;
        $this->container['company_name'] = $data['company_name'] ?? null;
        $this->container['company_domain'] = $data['company_domain'] ?? null;
        $this->container['company_country'] = $data['company_country'] ?? null;
        $this->container['company_industry'] = $data['company_industry'] ?? null;
        $this->container['language'] = $data['language'] ?? null;
    }

    /**
     * Show all the invalid properties with reasons.
     *
     * @return array invalid properties with reasons
     * @phpstan-return array<int, string>
     * @psalm-return array<int, string>
     */
    public function listInvalidProperties(): array
    {
        $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(): bool
    {
        return count($this->listInvalidProperties()) === 0;
    }


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

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

        return $this;
    }

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

    /**
     * Sets name
     *
     * @param string|null $name The user name
     *
     * @return self
     */
    public function setName($name): self
    {
        $this->container['name'] = $name;

        return $this;
    }

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

    /**
     * Sets default_currency
     *
     * @param string|null $default_currency The user default currency
     *
     * @return self
     */
    public function setDefaultCurrency($default_currency): self
    {
        $this->container['default_currency'] = $default_currency;

        return $this;
    }

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

    /**
     * Sets locale
     *
     * @param string|null $locale The user locale
     *
     * @return self
     */
    public function setLocale($locale): self
    {
        $this->container['locale'] = $locale;

        return $this;
    }

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

    /**
     * Sets lang
     *
     * @param int|null $lang The user language ID
     *
     * @return self
     */
    public function setLang($lang): self
    {
        $this->container['lang'] = $lang;

        return $this;
    }

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

    /**
     * Sets email
     *
     * @param string|null $email The user email
     *
     * @return self
     */
    public function setEmail($email): self
    {
        $this->container['email'] = $email;

        return $this;
    }

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

    /**
     * Sets phone
     *
     * @param string|null $phone The user phone
     *
     * @return self
     */
    public function setPhone($phone): self
    {
        $this->container['phone'] = $phone;

        return $this;
    }

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

    /**
     * Sets activated
     *
     * @param bool|null $activated Boolean that indicates whether the user is activated
     *
     * @return self
     */
    public function setActivated($activated): self
    {
        $this->container['activated'] = $activated;

        return $this;
    }

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

    /**
     * Sets last_login
     *
     * @param string|null $last_login The last login date and time of the user. Format: YYYY-MM-DD HH:MM:SS
     *
     * @return self
     */
    public function setLastLogin($last_login): self
    {
        $this->container['last_login'] = $last_login;

        return $this;
    }

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

    /**
     * Sets created
     *
     * @param string|null $created The creation date and time of the user. Format: YYYY-MM-DD HH:MM:SS
     *
     * @return self
     */
    public function setCreated($created): self
    {
        $this->container['created'] = $created;

        return $this;
    }

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

    /**
     * Sets modified
     *
     * @param string|null $modified The last modification date and time of the user. Format: YYYY-MM-DD HH:MM:SS
     *
     * @return self
     */
    public function setModified($modified): self
    {
        $this->container['modified'] = $modified;

        return $this;
    }

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

    /**
     * Sets has_created_company
     *
     * @param bool|null $has_created_company Boolean that indicates whether the user has created a company
     *
     * @return self
     */
    public function setHasCreatedCompany($has_created_company): self
    {
        $this->container['has_created_company'] = $has_created_company;

        return $this;
    }

    /**
     * Gets access
     *
     * @return \Pipedrive\Model\UserAccess[]|null
     */
    public function getAccess()
    {
        return $this->container['access'];
    }

    /**
     * Sets access
     *
     * @param \Pipedrive\Model\UserAccess[]|null $access access
     *
     * @return self
     */
    public function setAccess($access): self
    {
        $this->container['access'] = $access;

        return $this;
    }

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

    /**
     * Sets active_flag
     *
     * @param bool|null $active_flag Boolean that indicates whether the user is activated
     *
     * @return self
     */
    public function setActiveFlag($active_flag): self
    {
        $this->container['active_flag'] = $active_flag;

        return $this;
    }

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

    /**
     * Sets timezone_name
     *
     * @param string|null $timezone_name The user timezone name
     *
     * @return self
     */
    public function setTimezoneName($timezone_name): self
    {
        $this->container['timezone_name'] = $timezone_name;

        return $this;
    }

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

    /**
     * Sets timezone_offset
     *
     * @param string|null $timezone_offset The user timezone offset
     *
     * @return self
     */
    public function setTimezoneOffset($timezone_offset): self
    {
        $this->container['timezone_offset'] = $timezone_offset;

        return $this;
    }

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

    /**
     * Sets role_id
     *
     * @param int|null $role_id The ID of the user role
     *
     * @return self
     */
    public function setRoleId($role_id): self
    {
        $this->container['role_id'] = $role_id;

        return $this;
    }

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

    /**
     * Sets icon_url
     *
     * @param string|null $icon_url The user icon URL
     *
     * @return self
     */
    public function setIconUrl($icon_url): self
    {
        $this->container['icon_url'] = $icon_url;

        return $this;
    }

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

    /**
     * Sets is_you
     *
     * @param bool|null $is_you Boolean that indicates if the requested user is the same which is logged in (in this case, always true)
     *
     * @return self
     */
    public function setIsYou($is_you): self
    {
        $this->container['is_you'] = $is_you;

        return $this;
    }

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

    /**
     * Sets is_deleted
     *
     * @param bool|null $is_deleted Boolean that indicates whether the user is deleted from the company
     *
     * @return self
     */
    public function setIsDeleted($is_deleted): self
    {
        $this->container['is_deleted'] = $is_deleted;

        return $this;
    }

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

    /**
     * Sets company_id
     *
     * @param int|null $company_id The user company ID
     *
     * @return self
     */
    public function setCompanyId($company_id): self
    {
        $this->container['company_id'] = $company_id;

        return $this;
    }

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

    /**
     * Sets company_name
     *
     * @param string|null $company_name The user company name
     *
     * @return self
     */
    public function setCompanyName($company_name): self
    {
        $this->container['company_name'] = $company_name;

        return $this;
    }

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

    /**
     * Sets company_domain
     *
     * @param string|null $company_domain The user company domain
     *
     * @return self
     */
    public function setCompanyDomain($company_domain): self
    {
        $this->container['company_domain'] = $company_domain;

        return $this;
    }

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

    /**
     * Sets company_country
     *
     * @param string|null $company_country The user company country
     *
     * @return self
     */
    public function setCompanyCountry($company_country): self
    {
        $this->container['company_country'] = $company_country;

        return $this;
    }

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

    /**
     * Sets company_industry
     *
     * @param string|null $company_industry The user company industry
     *
     * @return self
     */
    public function setCompanyIndustry($company_industry): self
    {
        $this->container['company_industry'] = $company_industry;

        return $this;
    }

    /**
     * Gets language
     *
     * @return \Pipedrive\Model\BaseUserMeAllOfLanguage|null
     */
    public function getLanguage()
    {
        return $this->container['language'];
    }

    /**
     * Sets language
     *
     * @param \Pipedrive\Model\BaseUserMeAllOfLanguage|null $language language
     *
     * @return self
     */
    public function setLanguage($language): self
    {
        $this->container['language'] = $language;

        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
     */
    public function offsetGet($offset): mixed
    {
        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.
     */
    public function jsonSerialize(): mixed
    {
       return ObjectSerializer::sanitizeForSerialization($this);
    }

    /**
     * Gets the string presentation of the object
     *
     * @throws JsonException
     * @return string
     */
    public function __toString()
    {
        return json_encode(
            ObjectSerializer::sanitizeForSerialization($this),
            JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR
        );
    }

    /**
     * Gets a header-safe presentation of the object
     *
     * @throws JsonException
     * @return string
     */
    public function toHeaderValue(): string
    {
        return json_encode(ObjectSerializer::sanitizeForSerialization($this), JSON_THROW_ON_ERROR);
    }
}


