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

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

    public const DISCRIMINATOR = null;

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

    /**
      * 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 = [
        'title' => 'string',
        'project_id' => 'float',
        'description' => 'string',
        'parent_task_id' => 'float',
        'assignee_id' => 'float',
        'done' => '\Pipedrive\Model\NumberBoolean',
        'due_date' => '\DateTime',
        'creator_id' => 'float',
        'add_time' => 'string',
        'update_time' => 'string',
        'marked_as_done_time' => '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 = [
        'title' => null,
        'project_id' => null,
        'description' => null,
        'parent_task_id' => null,
        'assignee_id' => null,
        'done' => null,
        'due_date' => 'date',
        'creator_id' => null,
        'add_time' => null,
        'update_time' => null,
        'marked_as_done_time' => 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 = [
        'title' => 'title',
        'project_id' => 'project_id',
        'description' => 'description',
        'parent_task_id' => 'parent_task_id',
        'assignee_id' => 'assignee_id',
        'done' => 'done',
        'due_date' => 'due_date',
        'creator_id' => 'creator_id',
        'add_time' => 'add_time',
        'update_time' => 'update_time',
        'marked_as_done_time' => 'marked_as_done_time'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'title' => 'setTitle',
        'project_id' => 'setProjectId',
        'description' => 'setDescription',
        'parent_task_id' => 'setParentTaskId',
        'assignee_id' => 'setAssigneeId',
        'done' => 'setDone',
        'due_date' => 'setDueDate',
        'creator_id' => 'setCreatorId',
        'add_time' => 'setAddTime',
        'update_time' => 'setUpdateTime',
        'marked_as_done_time' => 'setMarkedAsDoneTime'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'title' => 'getTitle',
        'project_id' => 'getProjectId',
        'description' => 'getDescription',
        'parent_task_id' => 'getParentTaskId',
        'assignee_id' => 'getAssigneeId',
        'done' => 'getDone',
        'due_date' => 'getDueDate',
        'creator_id' => 'getCreatorId',
        'add_time' => 'getAddTime',
        'update_time' => 'getUpdateTime',
        'marked_as_done_time' => 'getMarkedAsDoneTime'
    ];

    /**
     * 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['title'] = $data['title'] ?? null;
        $this->container['project_id'] = $data['project_id'] ?? null;
        $this->container['description'] = $data['description'] ?? null;
        $this->container['parent_task_id'] = $data['parent_task_id'] ?? null;
        $this->container['assignee_id'] = $data['assignee_id'] ?? null;
        $this->container['done'] = $data['done'] ?? null;
        $this->container['due_date'] = $data['due_date'] ?? null;
        $this->container['creator_id'] = $data['creator_id'] ?? null;
        $this->container['add_time'] = $data['add_time'] ?? null;
        $this->container['update_time'] = $data['update_time'] ?? null;
        $this->container['marked_as_done_time'] = $data['marked_as_done_time'] ?? 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 title
     *
     * @return string|null
     */
    public function getTitle()
    {
        return $this->container['title'];
    }

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

        return $this;
    }

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

    /**
     * Sets project_id
     *
     * @param float|null $project_id The ID of the project this task is associated with
     *
     * @return self
     */
    public function setProjectId($project_id): self
    {
        $this->container['project_id'] = $project_id;

        return $this;
    }

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

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

        return $this;
    }

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

    /**
     * Sets parent_task_id
     *
     * @param float|null $parent_task_id The ID of a parent task. Can not be ID of a task which is already a subtask.
     *
     * @return self
     */
    public function setParentTaskId($parent_task_id): self
    {
        $this->container['parent_task_id'] = $parent_task_id;

        return $this;
    }

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

    /**
     * Sets assignee_id
     *
     * @param float|null $assignee_id The ID of the user who will be the assignee of the task
     *
     * @return self
     */
    public function setAssigneeId($assignee_id): self
    {
        $this->container['assignee_id'] = $assignee_id;

        return $this;
    }

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

    /**
     * Sets done
     *
     * @param \Pipedrive\Model\NumberBoolean|null $done Whether the task is done or not. 0 = Not done, 1 = Done.
     *
     * @return self
     */
    public function setDone($done): self
    {
        $this->container['done'] = $done;

        return $this;
    }

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

    /**
     * Sets due_date
     *
     * @param \DateTime|null $due_date The due date of the task. Format: YYYY-MM-DD.
     *
     * @return self
     */
    public function setDueDate($due_date): self
    {
        $this->container['due_date'] = $due_date;

        return $this;
    }

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

    /**
     * Sets creator_id
     *
     * @param float|null $creator_id The creator of a task
     *
     * @return self
     */
    public function setCreatorId($creator_id): self
    {
        $this->container['creator_id'] = $creator_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 creation date and time of the task in UTC. 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 update date and time of the task in UTC. Format: YYYY-MM-DD HH:MM:SS.
     *
     * @return self
     */
    public function setUpdateTime($update_time): self
    {
        $this->container['update_time'] = $update_time;

        return $this;
    }

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

    /**
     * Sets marked_as_done_time
     *
     * @param string|null $marked_as_done_time The marked as done date and time of the task in UTC. Format: YYYY-MM-DD HH:MM:SS.
     *
     * @return self
     */
    public function setMarkedAsDoneTime($marked_as_done_time): self
    {
        $this->container['marked_as_done_time'] = $marked_as_done_time;

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


