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

/**
 * MailMessageItemForListAllOf 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 MailMessageItemForListAllOf implements ModelInterface, ArrayAccess, JsonSerializable
{
    use RawData;

    public const DISCRIMINATOR = null;

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

    /**
      * 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 = [
        'nylas_id' => 'string',
        's3_bucket' => 'string',
        's3_bucket_path' => 'string',
        'external_deleted_flag' => 'bool',
        'mua_message_id' => 'string',
        'template_id' => 'int',
        'timestamp' => 'string',
        'item_type' => 'string',
        'company_id' => '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 = [
        'nylas_id' => null,
        's3_bucket' => null,
        's3_bucket_path' => null,
        'external_deleted_flag' => null,
        'mua_message_id' => null,
        'template_id' => null,
        'timestamp' => null,
        'item_type' => null,
        'company_id' => 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 = [
        'nylas_id' => 'nylas_id',
        's3_bucket' => 's3_bucket',
        's3_bucket_path' => 's3_bucket_path',
        'external_deleted_flag' => 'external_deleted_flag',
        'mua_message_id' => 'mua_message_id',
        'template_id' => 'template_id',
        'timestamp' => 'timestamp',
        'item_type' => 'item_type',
        'company_id' => 'company_id'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'nylas_id' => 'setNylasId',
        's3_bucket' => 'setS3Bucket',
        's3_bucket_path' => 'setS3BucketPath',
        'external_deleted_flag' => 'setExternalDeletedFlag',
        'mua_message_id' => 'setMuaMessageId',
        'template_id' => 'setTemplateId',
        'timestamp' => 'setTimestamp',
        'item_type' => 'setItemType',
        'company_id' => 'setCompanyId'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'nylas_id' => 'getNylasId',
        's3_bucket' => 'getS3Bucket',
        's3_bucket_path' => 'getS3BucketPath',
        'external_deleted_flag' => 'getExternalDeletedFlag',
        'mua_message_id' => 'getMuaMessageId',
        'template_id' => 'getTemplateId',
        'timestamp' => 'getTimestamp',
        'item_type' => 'getItemType',
        'company_id' => 'getCompanyId'
    ];

    /**
     * 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['nylas_id'] = $data['nylas_id'] ?? null;
        $this->container['s3_bucket'] = $data['s3_bucket'] ?? null;
        $this->container['s3_bucket_path'] = $data['s3_bucket_path'] ?? null;
        $this->container['external_deleted_flag'] = $data['external_deleted_flag'] ?? null;
        $this->container['mua_message_id'] = $data['mua_message_id'] ?? null;
        $this->container['template_id'] = $data['template_id'] ?? null;
        $this->container['timestamp'] = $data['timestamp'] ?? null;
        $this->container['item_type'] = $data['item_type'] ?? null;
        $this->container['company_id'] = $data['company_id'] ?? 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 nylas_id
     *
     * @return string|null
     */
    public function getNylasId()
    {
        return $this->container['nylas_id'];
    }

    /**
     * Sets nylas_id
     *
     * @param string|null $nylas_id The Mail Message ID assigned by the sync provider
     *
     * @return self
     */
    public function setNylasId($nylas_id): self
    {
        $this->container['nylas_id'] = $nylas_id;

        return $this;
    }

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

    /**
     * Sets s3_bucket
     *
     * @param string|null $s3_bucket The name of the S3 bucket
     *
     * @return self
     */
    public function setS3Bucket($s3_bucket): self
    {
        $this->container['s3_bucket'] = $s3_bucket;

        return $this;
    }

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

    /**
     * Sets s3_bucket_path
     *
     * @param string|null $s3_bucket_path The path of the S3 bucket
     *
     * @return self
     */
    public function setS3BucketPath($s3_bucket_path): self
    {
        $this->container['s3_bucket_path'] = $s3_bucket_path;

        return $this;
    }

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

    /**
     * Sets external_deleted_flag
     *
     * @param bool|null $external_deleted_flag If the Mail Message has been deleted on the provider side or not
     *
     * @return self
     */
    public function setExternalDeletedFlag($external_deleted_flag): self
    {
        $this->container['external_deleted_flag'] = $external_deleted_flag;

        return $this;
    }

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

    /**
     * Sets mua_message_id
     *
     * @param string|null $mua_message_id The Mail Message ID assigned by the mail user agent
     *
     * @return self
     */
    public function setMuaMessageId($mua_message_id): self
    {
        $this->container['mua_message_id'] = $mua_message_id;

        return $this;
    }

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

    /**
     * Sets template_id
     *
     * @param int|null $template_id The ID of the mail template
     *
     * @return self
     */
    public function setTemplateId($template_id): self
    {
        $this->container['template_id'] = $template_id;

        return $this;
    }

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

    /**
     * Sets timestamp
     *
     * @param string|null $timestamp The add date and time of the Mail Message
     *
     * @return self
     */
    public function setTimestamp($timestamp): self
    {
        $this->container['timestamp'] = $timestamp;

        return $this;
    }

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

    /**
     * Sets item_type
     *
     * @param string|null $item_type The type of the data item
     *
     * @return self
     */
    public function setItemType($item_type): self
    {
        $this->container['item_type'] = $item_type;

        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 ID of the company
     *
     * @return self
     */
    public function setCompanyId($company_id): self
    {
        $this->container['company_id'] = $company_id;

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


