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

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

    public const DISCRIMINATOR = null;

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

    /**
      * 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',
        'user_id' => 'int',
        'deal_id' => 'int',
        'person_id' => 'int',
        'org_id' => 'int',
        'product_id' => 'int',
        'activity_id' => 'int',
        'lead_id' => 'string',
        'add_time' => 'string',
        'update_time' => 'string',
        'file_name' => 'string',
        'file_size' => 'int',
        'active_flag' => 'bool',
        'inline_flag' => 'bool',
        'remote_location' => 'string',
        'remote_id' => 'string',
        'cid' => 'string',
        's3_bucket' => 'string',
        'mail_message_id' => 'string',
        'mail_template_id' => 'string',
        'deal_name' => 'string',
        'person_name' => 'string',
        'org_name' => 'string',
        'product_name' => 'string',
        'lead_name' => 'string',
        'url' => 'string',
        'name' => 'string',
        'description' => 'string'
    ];

    /**
      * 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,
        'user_id' => null,
        'deal_id' => null,
        'person_id' => null,
        'org_id' => null,
        'product_id' => null,
        'activity_id' => null,
        'lead_id' => 'uuid',
        'add_time' => null,
        'update_time' => null,
        'file_name' => null,
        'file_size' => null,
        'active_flag' => null,
        'inline_flag' => null,
        'remote_location' => null,
        'remote_id' => null,
        'cid' => null,
        's3_bucket' => null,
        'mail_message_id' => null,
        'mail_template_id' => null,
        'deal_name' => null,
        'person_name' => null,
        'org_name' => null,
        'product_name' => null,
        'lead_name' => null,
        'url' => null,
        'name' => null,
        'description' => 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',
        'user_id' => 'user_id',
        'deal_id' => 'deal_id',
        'person_id' => 'person_id',
        'org_id' => 'org_id',
        'product_id' => 'product_id',
        'activity_id' => 'activity_id',
        'lead_id' => 'lead_id',
        'add_time' => 'add_time',
        'update_time' => 'update_time',
        'file_name' => 'file_name',
        'file_size' => 'file_size',
        'active_flag' => 'active_flag',
        'inline_flag' => 'inline_flag',
        'remote_location' => 'remote_location',
        'remote_id' => 'remote_id',
        'cid' => 'cid',
        's3_bucket' => 's3_bucket',
        'mail_message_id' => 'mail_message_id',
        'mail_template_id' => 'mail_template_id',
        'deal_name' => 'deal_name',
        'person_name' => 'person_name',
        'org_name' => 'org_name',
        'product_name' => 'product_name',
        'lead_name' => 'lead_name',
        'url' => 'url',
        'name' => 'name',
        'description' => 'description'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'id' => 'setId',
        'user_id' => 'setUserId',
        'deal_id' => 'setDealId',
        'person_id' => 'setPersonId',
        'org_id' => 'setOrgId',
        'product_id' => 'setProductId',
        'activity_id' => 'setActivityId',
        'lead_id' => 'setLeadId',
        'add_time' => 'setAddTime',
        'update_time' => 'setUpdateTime',
        'file_name' => 'setFileName',
        'file_size' => 'setFileSize',
        'active_flag' => 'setActiveFlag',
        'inline_flag' => 'setInlineFlag',
        'remote_location' => 'setRemoteLocation',
        'remote_id' => 'setRemoteId',
        'cid' => 'setCid',
        's3_bucket' => 'setS3Bucket',
        'mail_message_id' => 'setMailMessageId',
        'mail_template_id' => 'setMailTemplateId',
        'deal_name' => 'setDealName',
        'person_name' => 'setPersonName',
        'org_name' => 'setOrgName',
        'product_name' => 'setProductName',
        'lead_name' => 'setLeadName',
        'url' => 'setUrl',
        'name' => 'setName',
        'description' => 'setDescription'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'id' => 'getId',
        'user_id' => 'getUserId',
        'deal_id' => 'getDealId',
        'person_id' => 'getPersonId',
        'org_id' => 'getOrgId',
        'product_id' => 'getProductId',
        'activity_id' => 'getActivityId',
        'lead_id' => 'getLeadId',
        'add_time' => 'getAddTime',
        'update_time' => 'getUpdateTime',
        'file_name' => 'getFileName',
        'file_size' => 'getFileSize',
        'active_flag' => 'getActiveFlag',
        'inline_flag' => 'getInlineFlag',
        'remote_location' => 'getRemoteLocation',
        'remote_id' => 'getRemoteId',
        'cid' => 'getCid',
        's3_bucket' => 'getS3Bucket',
        'mail_message_id' => 'getMailMessageId',
        'mail_template_id' => 'getMailTemplateId',
        'deal_name' => 'getDealName',
        'person_name' => 'getPersonName',
        'org_name' => 'getOrgName',
        'product_name' => 'getProductName',
        'lead_name' => 'getLeadName',
        'url' => 'getUrl',
        'name' => 'getName',
        'description' => 'getDescription'
    ];

    /**
     * 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['user_id'] = $data['user_id'] ?? null;
        $this->container['deal_id'] = $data['deal_id'] ?? null;
        $this->container['person_id'] = $data['person_id'] ?? null;
        $this->container['org_id'] = $data['org_id'] ?? null;
        $this->container['product_id'] = $data['product_id'] ?? null;
        $this->container['activity_id'] = $data['activity_id'] ?? null;
        $this->container['lead_id'] = $data['lead_id'] ?? null;
        $this->container['add_time'] = $data['add_time'] ?? null;
        $this->container['update_time'] = $data['update_time'] ?? null;
        $this->container['file_name'] = $data['file_name'] ?? null;
        $this->container['file_size'] = $data['file_size'] ?? null;
        $this->container['active_flag'] = $data['active_flag'] ?? null;
        $this->container['inline_flag'] = $data['inline_flag'] ?? null;
        $this->container['remote_location'] = $data['remote_location'] ?? null;
        $this->container['remote_id'] = $data['remote_id'] ?? null;
        $this->container['cid'] = $data['cid'] ?? null;
        $this->container['s3_bucket'] = $data['s3_bucket'] ?? null;
        $this->container['mail_message_id'] = $data['mail_message_id'] ?? null;
        $this->container['mail_template_id'] = $data['mail_template_id'] ?? null;
        $this->container['deal_name'] = $data['deal_name'] ?? null;
        $this->container['person_name'] = $data['person_name'] ?? null;
        $this->container['org_name'] = $data['org_name'] ?? null;
        $this->container['product_name'] = $data['product_name'] ?? null;
        $this->container['lead_name'] = $data['lead_name'] ?? null;
        $this->container['url'] = $data['url'] ?? null;
        $this->container['name'] = $data['name'] ?? null;
        $this->container['description'] = $data['description'] ?? 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 ID of the file
     *
     * @return self
     */
    public function setId($id): self
    {
        $this->container['id'] = $id;

        return $this;
    }

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

    /**
     * Sets user_id
     *
     * @param int|null $user_id The ID of the user to associate the file with
     *
     * @return self
     */
    public function setUserId($user_id): self
    {
        $this->container['user_id'] = $user_id;

        return $this;
    }

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

    /**
     * Sets deal_id
     *
     * @param int|null $deal_id The ID of the deal to associate the file with
     *
     * @return self
     */
    public function setDealId($deal_id): self
    {
        $this->container['deal_id'] = $deal_id;

        return $this;
    }

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

    /**
     * Sets person_id
     *
     * @param int|null $person_id The ID of the person to associate the file with
     *
     * @return self
     */
    public function setPersonId($person_id): self
    {
        $this->container['person_id'] = $person_id;

        return $this;
    }

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

    /**
     * Sets org_id
     *
     * @param int|null $org_id The ID of the organization to associate the file with
     *
     * @return self
     */
    public function setOrgId($org_id): self
    {
        $this->container['org_id'] = $org_id;

        return $this;
    }

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

    /**
     * Sets product_id
     *
     * @param int|null $product_id The ID of the product to associate the file with
     *
     * @return self
     */
    public function setProductId($product_id): self
    {
        $this->container['product_id'] = $product_id;

        return $this;
    }

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

    /**
     * Sets activity_id
     *
     * @param int|null $activity_id The ID of the activity to associate the file with
     *
     * @return self
     */
    public function setActivityId($activity_id): self
    {
        $this->container['activity_id'] = $activity_id;

        return $this;
    }

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

    /**
     * Sets lead_id
     *
     * @param string|null $lead_id The ID of the lead to associate the file with
     *
     * @return self
     */
    public function setLeadId($lead_id): self
    {
        $this->container['lead_id'] = $lead_id;

        return $this;
    }

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

    /**
     * Sets add_time
     *
     * @param string|null $add_time The date and time when the file was added/created. Format: YYYY-MM-DD HH:MM:SS
     *
     * @return self
     */
    public function setAddTime($add_time): self
    {
        $this->container['add_time'] = $add_time;

        return $this;
    }

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

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

        return $this;
    }

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

    /**
     * Sets file_name
     *
     * @param string|null $file_name The original name of the file
     *
     * @return self
     */
    public function setFileName($file_name): self
    {
        $this->container['file_name'] = $file_name;

        return $this;
    }

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

    /**
     * Sets file_size
     *
     * @param int|null $file_size The size of the file
     *
     * @return self
     */
    public function setFileSize($file_size): self
    {
        $this->container['file_size'] = $file_size;

        return $this;
    }

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

    /**
     * Sets active_flag
     *
     * @param bool|null $active_flag Whether the user is active or not. false = Not activated, true = Activated
     *
     * @return self
     */
    public function setActiveFlag($active_flag): self
    {
        $this->container['active_flag'] = $active_flag;

        return $this;
    }

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

    /**
     * Sets inline_flag
     *
     * @param bool|null $inline_flag Whether the file was uploaded as inline or not
     *
     * @return self
     */
    public function setInlineFlag($inline_flag): self
    {
        $this->container['inline_flag'] = $inline_flag;

        return $this;
    }

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

    /**
     * Sets remote_location
     *
     * @param string|null $remote_location The location type to send the file to. Only googledrive is supported at the moment.
     *
     * @return self
     */
    public function setRemoteLocation($remote_location): self
    {
        $this->container['remote_location'] = $remote_location;

        return $this;
    }

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

    /**
     * Sets remote_id
     *
     * @param string|null $remote_id The ID of the remote item
     *
     * @return self
     */
    public function setRemoteId($remote_id): self
    {
        $this->container['remote_id'] = $remote_id;

        return $this;
    }

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

    /**
     * Sets cid
     *
     * @param string|null $cid The ID of the inline attachment
     *
     * @return self
     */
    public function setCid($cid): self
    {
        $this->container['cid'] = $cid;

        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 location of the cloud storage
     *
     * @return self
     */
    public function setS3Bucket($s3_bucket): self
    {
        $this->container['s3_bucket'] = $s3_bucket;

        return $this;
    }

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

    /**
     * Sets mail_message_id
     *
     * @param string|null $mail_message_id The ID of the mail message to associate the file with
     *
     * @return self
     */
    public function setMailMessageId($mail_message_id): self
    {
        $this->container['mail_message_id'] = $mail_message_id;

        return $this;
    }

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

    /**
     * Sets mail_template_id
     *
     * @param string|null $mail_template_id The ID of the mail template to associate the file with
     *
     * @return self
     */
    public function setMailTemplateId($mail_template_id): self
    {
        $this->container['mail_template_id'] = $mail_template_id;

        return $this;
    }

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

    /**
     * Sets deal_name
     *
     * @param string|null $deal_name The name of the deal associated with the dile
     *
     * @return self
     */
    public function setDealName($deal_name): self
    {
        $this->container['deal_name'] = $deal_name;

        return $this;
    }

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

    /**
     * Sets person_name
     *
     * @param string|null $person_name The name of the person associated with the file
     *
     * @return self
     */
    public function setPersonName($person_name): self
    {
        $this->container['person_name'] = $person_name;

        return $this;
    }

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

    /**
     * Sets org_name
     *
     * @param string|null $org_name The name of the organization associated with the file
     *
     * @return self
     */
    public function setOrgName($org_name): self
    {
        $this->container['org_name'] = $org_name;

        return $this;
    }

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

    /**
     * Sets product_name
     *
     * @param string|null $product_name The name of the product associated with the file
     *
     * @return self
     */
    public function setProductName($product_name): self
    {
        $this->container['product_name'] = $product_name;

        return $this;
    }

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

    /**
     * Sets lead_name
     *
     * @param string|null $lead_name The name of the lead associated with the file
     *
     * @return self
     */
    public function setLeadName($lead_name): self
    {
        $this->container['lead_name'] = $lead_name;

        return $this;
    }

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

    /**
     * Sets url
     *
     * @param string|null $url The URL of the download file
     *
     * @return self
     */
    public function setUrl($url): self
    {
        $this->container['url'] = $url;

        return $this;
    }

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

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

        return $this;
    }

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

    /**
     * Sets description
     *
     * @param string|null $description The description of the file
     *
     * @return self
     */
    public function setDescription($description): self
    {
        $this->container['description'] = $description;

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


