<?php
/**
 * RoleSettings
 *
 * 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;

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

    public const DISCRIMINATOR = null;

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

    /**
      * 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 = [
        'deal_default_visibility' => 'float',
        'lead_default_visibility' => 'float',
        'org_default_visibility' => 'float',
        'person_default_visibility' => 'float',
        'product_default_visibility' => 'float',
        'deal_access_level' => 'float',
        'org_access_level' => 'float',
        'person_access_level' => 'float',
        'product_access_level' => 'float'
    ];

    /**
      * 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 = [
        'deal_default_visibility' => null,
        'lead_default_visibility' => null,
        'org_default_visibility' => null,
        'person_default_visibility' => null,
        'product_default_visibility' => null,
        'deal_access_level' => null,
        'org_access_level' => null,
        'person_access_level' => null,
        'product_access_level' => 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 = [
        'deal_default_visibility' => 'deal_default_visibility',
        'lead_default_visibility' => 'lead_default_visibility',
        'org_default_visibility' => 'org_default_visibility',
        'person_default_visibility' => 'person_default_visibility',
        'product_default_visibility' => 'product_default_visibility',
        'deal_access_level' => 'deal_access_level',
        'org_access_level' => 'org_access_level',
        'person_access_level' => 'person_access_level',
        'product_access_level' => 'product_access_level'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'deal_default_visibility' => 'setDealDefaultVisibility',
        'lead_default_visibility' => 'setLeadDefaultVisibility',
        'org_default_visibility' => 'setOrgDefaultVisibility',
        'person_default_visibility' => 'setPersonDefaultVisibility',
        'product_default_visibility' => 'setProductDefaultVisibility',
        'deal_access_level' => 'setDealAccessLevel',
        'org_access_level' => 'setOrgAccessLevel',
        'person_access_level' => 'setPersonAccessLevel',
        'product_access_level' => 'setProductAccessLevel'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'deal_default_visibility' => 'getDealDefaultVisibility',
        'lead_default_visibility' => 'getLeadDefaultVisibility',
        'org_default_visibility' => 'getOrgDefaultVisibility',
        'person_default_visibility' => 'getPersonDefaultVisibility',
        'product_default_visibility' => 'getProductDefaultVisibility',
        'deal_access_level' => 'getDealAccessLevel',
        'org_access_level' => 'getOrgAccessLevel',
        'person_access_level' => 'getPersonAccessLevel',
        'product_access_level' => 'getProductAccessLevel'
    ];

    /**
     * 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['deal_default_visibility'] = $data['deal_default_visibility'] ?? null;
        $this->container['lead_default_visibility'] = $data['lead_default_visibility'] ?? null;
        $this->container['org_default_visibility'] = $data['org_default_visibility'] ?? null;
        $this->container['person_default_visibility'] = $data['person_default_visibility'] ?? null;
        $this->container['product_default_visibility'] = $data['product_default_visibility'] ?? null;
        $this->container['deal_access_level'] = $data['deal_access_level'] ?? null;
        $this->container['org_access_level'] = $data['org_access_level'] ?? null;
        $this->container['person_access_level'] = $data['person_access_level'] ?? null;
        $this->container['product_access_level'] = $data['product_access_level'] ?? 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 deal_default_visibility
     *
     * @return float|null
     */
    public function getDealDefaultVisibility()
    {
        return $this->container['deal_default_visibility'];
    }

    /**
     * Sets deal_default_visibility
     *
     * @param float|null $deal_default_visibility The default visibility level of the deals for the role
     *
     * @return self
     */
    public function setDealDefaultVisibility($deal_default_visibility): self
    {
        $this->container['deal_default_visibility'] = $deal_default_visibility;

        return $this;
    }

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

    /**
     * Sets lead_default_visibility
     *
     * @param float|null $lead_default_visibility The default visibility level of the leads for the role
     *
     * @return self
     */
    public function setLeadDefaultVisibility($lead_default_visibility): self
    {
        $this->container['lead_default_visibility'] = $lead_default_visibility;

        return $this;
    }

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

    /**
     * Sets org_default_visibility
     *
     * @param float|null $org_default_visibility The default visibility level of the organizations for the role
     *
     * @return self
     */
    public function setOrgDefaultVisibility($org_default_visibility): self
    {
        $this->container['org_default_visibility'] = $org_default_visibility;

        return $this;
    }

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

    /**
     * Sets person_default_visibility
     *
     * @param float|null $person_default_visibility The default visibility level of the people for the role
     *
     * @return self
     */
    public function setPersonDefaultVisibility($person_default_visibility): self
    {
        $this->container['person_default_visibility'] = $person_default_visibility;

        return $this;
    }

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

    /**
     * Sets product_default_visibility
     *
     * @param float|null $product_default_visibility The default visibility level of the products for the role
     *
     * @return self
     */
    public function setProductDefaultVisibility($product_default_visibility): self
    {
        $this->container['product_default_visibility'] = $product_default_visibility;

        return $this;
    }

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

    /**
     * Sets deal_access_level
     *
     * @param float|null $deal_access_level The access level of the deals for the role (only for default role)
     *
     * @return self
     */
    public function setDealAccessLevel($deal_access_level): self
    {
        $this->container['deal_access_level'] = $deal_access_level;

        return $this;
    }

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

    /**
     * Sets org_access_level
     *
     * @param float|null $org_access_level The access level of the organizations for the role (only for default role)
     *
     * @return self
     */
    public function setOrgAccessLevel($org_access_level): self
    {
        $this->container['org_access_level'] = $org_access_level;

        return $this;
    }

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

    /**
     * Sets person_access_level
     *
     * @param float|null $person_access_level The access level of the people for the role (only for default role)
     *
     * @return self
     */
    public function setPersonAccessLevel($person_access_level): self
    {
        $this->container['person_access_level'] = $person_access_level;

        return $this;
    }

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

    /**
     * Sets product_access_level
     *
     * @param float|null $product_access_level The access level of the products for the role (only for default role)
     *
     * @return self
     */
    public function setProductAccessLevel($product_access_level): self
    {
        $this->container['product_access_level'] = $product_access_level;

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


