<?php

// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.

namespace Algolia\AlgoliaSearch\Model\AgentStudio;

use Algolia\AlgoliaSearch\Model\AbstractModel;
use Algolia\AlgoliaSearch\Model\ModelInterface;

/**
 * MemoryRecord Class Doc Comment.
 *
 * @category Class
 *
 * @description Universal storage model for all memory types (semantic, episodic).  This is the ONLY model that touches storage (Algolia). Domain models (SemanticMemory, EpisodicMemory) are used for LLM extraction and converted to MemoryRecord before saving.  See https://langchain-ai.github.io/langmem/concepts/conceptual_guide/#memory-types for memory type definitions.
 */
class MemoryRecord extends AbstractModel implements ModelInterface, \ArrayAccess, \JsonSerializable
{
    /**
     * Array of property to type mappings. Used for (de)serialization.
     *
     * @var string[]
     */
    protected static $modelTypes = [
        'memoryType' => '\Algolia\AlgoliaSearch\Model\AgentStudio\MemoryType',
        'episode' => '\Algolia\AlgoliaSearch\Model\AgentStudio\Episode',
        'text' => 'string',
        'rawExtract' => 'string',
        'keywords' => 'string[]',
        'topics' => 'string[]',
        'tags' => 'string[]',
        'recallTriggers' => 'string[]',
        'objectID' => 'string',
        'appId' => 'string',
        'agentIDs' => 'string[]',
        'userID' => 'string',
        'createdAt' => 'int',
        'updatedAt' => 'int',
    ];

    /**
     * Array of property to format mappings. Used for (de)serialization.
     *
     * @var string[]
     */
    protected static $modelFormats = [
        'memoryType' => null,
        'episode' => null,
        'text' => null,
        'rawExtract' => null,
        'keywords' => null,
        'topics' => null,
        'tags' => null,
        'recallTriggers' => null,
        'objectID' => null,
        'appId' => null,
        'agentIDs' => null,
        'userID' => null,
        'createdAt' => null,
        'updatedAt' => null,
    ];

    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name.
     *
     * @var string[]
     */
    protected static $attributeMap = [
        'memoryType' => 'memoryType',
        'episode' => 'episode',
        'text' => 'text',
        'rawExtract' => 'rawExtract',
        'keywords' => 'keywords',
        'topics' => 'topics',
        'tags' => '_tags',
        'recallTriggers' => 'recallTriggers',
        'objectID' => 'objectID',
        'appId' => 'appId',
        'agentIDs' => 'agentIDs',
        'userID' => 'userID',
        'createdAt' => 'createdAt',
        'updatedAt' => 'updatedAt',
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses).
     *
     * @var string[]
     */
    protected static $setters = [
        'memoryType' => 'setMemoryType',
        'episode' => 'setEpisode',
        'text' => 'setText',
        'rawExtract' => 'setRawExtract',
        'keywords' => 'setKeywords',
        'topics' => 'setTopics',
        'tags' => 'setTags',
        'recallTriggers' => 'setRecallTriggers',
        'objectID' => 'setObjectID',
        'appId' => 'setAppId',
        'agentIDs' => 'setAgentIDs',
        'userID' => 'setUserID',
        'createdAt' => 'setCreatedAt',
        'updatedAt' => 'setUpdatedAt',
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests).
     *
     * @var string[]
     */
    protected static $getters = [
        'memoryType' => 'getMemoryType',
        'episode' => 'getEpisode',
        'text' => 'getText',
        'rawExtract' => 'getRawExtract',
        'keywords' => 'getKeywords',
        'topics' => 'getTopics',
        'tags' => 'getTags',
        'recallTriggers' => 'getRecallTriggers',
        'objectID' => 'getObjectID',
        'appId' => 'getAppId',
        'agentIDs' => 'getAgentIDs',
        'userID' => 'getUserID',
        'createdAt' => 'getCreatedAt',
        'updatedAt' => 'getUpdatedAt',
    ];

    /**
     * Associative array for storing property values.
     *
     * @var mixed[]
     */
    protected $container = [];

    /**
     * Constructor.
     *
     * @param mixed[] $data Associated array of property values
     */
    public function __construct(?array $data = null)
    {
        if (isset($data['memoryType'])) {
            $this->container['memoryType'] = $data['memoryType'];
        }
        if (isset($data['episode'])) {
            $this->container['episode'] = $data['episode'];
        }
        if (isset($data['text'])) {
            $this->container['text'] = $data['text'];
        }
        if (isset($data['rawExtract'])) {
            $this->container['rawExtract'] = $data['rawExtract'];
        }
        if (isset($data['keywords'])) {
            $this->container['keywords'] = $data['keywords'];
        }
        if (isset($data['topics'])) {
            $this->container['topics'] = $data['topics'];
        }
        if (isset($data['tags'])) {
            $this->container['tags'] = $data['tags'];
        }
        if (isset($data['recallTriggers'])) {
            $this->container['recallTriggers'] = $data['recallTriggers'];
        }
        if (isset($data['objectID'])) {
            $this->container['objectID'] = $data['objectID'];
        }
        if (isset($data['appId'])) {
            $this->container['appId'] = $data['appId'];
        }
        if (isset($data['agentIDs'])) {
            $this->container['agentIDs'] = $data['agentIDs'];
        }
        if (isset($data['userID'])) {
            $this->container['userID'] = $data['userID'];
        }
        if (isset($data['createdAt'])) {
            $this->container['createdAt'] = $data['createdAt'];
        }
        if (isset($data['updatedAt'])) {
            $this->container['updatedAt'] = $data['updatedAt'];
        }
    }

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

    /**
     * Array of property to type mappings. Used for (de)serialization.
     *
     * @return array
     */
    public static function modelTypes()
    {
        return self::$modelTypes;
    }

    /**
     * Array of property to format mappings. Used for (de)serialization.
     *
     * @return array
     */
    public static function modelFormats()
    {
        return self::$modelFormats;
    }

    /**
     * Array of attributes to setter functions (for deserialization of responses).
     *
     * @return array
     */
    public static function setters()
    {
        return self::$setters;
    }

    /**
     * Array of attributes to getter functions (for serialization of requests).
     *
     * @return array
     */
    public static function getters()
    {
        return self::$getters;
    }

    /**
     * Show all the invalid properties with reasons.
     *
     * @return array invalid properties with reasons
     */
    public function listInvalidProperties()
    {
        $invalidProperties = [];

        if (!isset($this->container['text']) || null === $this->container['text']) {
            $invalidProperties[] = "'text' can't be null";
        }
        if (!isset($this->container['rawExtract']) || null === $this->container['rawExtract']) {
            $invalidProperties[] = "'rawExtract' can't be null";
        }

        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()
    {
        return 0 === count($this->listInvalidProperties());
    }

    /**
     * Gets memoryType.
     *
     * @return null|MemoryType
     */
    public function getMemoryType()
    {
        return $this->container['memoryType'] ?? null;
    }

    /**
     * Sets memoryType.
     *
     * @param null|MemoryType $memoryType memoryType
     *
     * @return self
     */
    public function setMemoryType($memoryType)
    {
        $this->container['memoryType'] = $memoryType;

        return $this;
    }

    /**
     * Gets episode.
     *
     * @return null|Episode
     */
    public function getEpisode()
    {
        return $this->container['episode'] ?? null;
    }

    /**
     * Sets episode.
     *
     * @param null|Episode $episode episode
     *
     * @return self
     */
    public function setEpisode($episode)
    {
        $this->container['episode'] = $episode;

        return $this;
    }

    /**
     * Gets text.
     *
     * @return string
     */
    public function getText()
    {
        return $this->container['text'] ?? null;
    }

    /**
     * Sets text.
     *
     * @param string $text self-contained, first-person memory for long-term recall
     *
     * @return self
     */
    public function setText($text)
    {
        $this->container['text'] = $text;

        return $this;
    }

    /**
     * Gets rawExtract.
     *
     * @return string
     */
    public function getRawExtract()
    {
        return $this->container['rawExtract'] ?? null;
    }

    /**
     * Sets rawExtract.
     *
     * @param string $rawExtract verbatim conversation extract, not paraphrased
     *
     * @return self
     */
    public function setRawExtract($rawExtract)
    {
        $this->container['rawExtract'] = $rawExtract;

        return $this;
    }

    /**
     * Gets keywords.
     *
     * @return null|string[]
     */
    public function getKeywords()
    {
        return $this->container['keywords'] ?? null;
    }

    /**
     * Sets keywords.
     *
     * @param null|string[] $keywords 5-20 free-form keywords: entities, context, search terms (any words)
     *
     * @return self
     */
    public function setKeywords($keywords)
    {
        $this->container['keywords'] = $keywords;

        return $this;
    }

    /**
     * Gets topics.
     *
     * @return null|string[]
     */
    public function getTopics()
    {
        return $this->container['topics'] ?? null;
    }

    /**
     * Sets topics.
     *
     * @param null|string[] $topics 2-4 topics ONLY from this list: [complaints, entertainment, family, feedback, finance, food, goals, health, history, hobbies, learning, praise, preferences, schedule, shopping, technical, travel, work]
     *
     * @return self
     */
    public function setTopics($topics)
    {
        $this->container['topics'] = $topics;

        return $this;
    }

    /**
     * Gets tags.
     *
     * @return null|string[]
     */
    public function getTags()
    {
        return $this->container['tags'] ?? null;
    }

    /**
     * Sets tags.
     *
     * @param null|string[] $tags Arbitrary labels/themes for flexible categorization (e.g., 'Q1-goals', 'paris-trip', 'vip-customer').
     *
     * @return self
     */
    public function setTags($tags)
    {
        $this->container['tags'] = $tags;

        return $this;
    }

    /**
     * Gets recallTriggers.
     *
     * @return null|string[]
     */
    public function getRecallTriggers()
    {
        return $this->container['recallTriggers'] ?? null;
    }

    /**
     * Sets recallTriggers.
     *
     * @param null|string[] $recallTriggers 3-5 natural phrases that should trigger this memory
     *
     * @return self
     */
    public function setRecallTriggers($recallTriggers)
    {
        $this->container['recallTriggers'] = $recallTriggers;

        return $this;
    }

    /**
     * Gets objectID.
     *
     * @return null|string
     */
    public function getObjectID()
    {
        return $this->container['objectID'] ?? null;
    }

    /**
     * Sets objectID.
     *
     * @param null|string $objectID ObjectID of existing memory to update. Leave empty for new memory.
     *
     * @return self
     */
    public function setObjectID($objectID)
    {
        $this->container['objectID'] = $objectID;

        return $this;
    }

    /**
     * Gets appId.
     *
     * @return null|string
     */
    public function getAppId()
    {
        return $this->container['appId'] ?? null;
    }

    /**
     * Sets appId.
     *
     * @param null|string $appId application ID
     *
     * @return self
     */
    public function setAppId($appId)
    {
        $this->container['appId'] = $appId;

        return $this;
    }

    /**
     * Gets agentIDs.
     *
     * @return null|string[]
     */
    public function getAgentIDs()
    {
        return $this->container['agentIDs'] ?? null;
    }

    /**
     * Sets agentIDs.
     *
     * @param null|string[] $agentIDs agent IDs with access: ['agent1'], ['*'] for all, ['*', '-agent1'] to exclude
     *
     * @return self
     */
    public function setAgentIDs($agentIDs)
    {
        $this->container['agentIDs'] = $agentIDs;

        return $this;
    }

    /**
     * Gets userID.
     *
     * @return null|string
     */
    public function getUserID()
    {
        return $this->container['userID'] ?? null;
    }

    /**
     * Sets userID.
     *
     * @param null|string $userID user ID
     *
     * @return self
     */
    public function setUserID($userID)
    {
        $this->container['userID'] = $userID;

        return $this;
    }

    /**
     * Gets createdAt.
     *
     * @return null|int
     */
    public function getCreatedAt()
    {
        return $this->container['createdAt'] ?? null;
    }

    /**
     * Sets createdAt.
     *
     * @param null|int $createdAt epoch seconds
     *
     * @return self
     */
    public function setCreatedAt($createdAt)
    {
        $this->container['createdAt'] = $createdAt;

        return $this;
    }

    /**
     * Gets updatedAt.
     *
     * @return null|int
     */
    public function getUpdatedAt()
    {
        return $this->container['updatedAt'] ?? null;
    }

    /**
     * Sets updatedAt.
     *
     * @param null|int $updatedAt epoch seconds
     *
     * @return self
     */
    public function setUpdatedAt($updatedAt)
    {
        $this->container['updatedAt'] = $updatedAt;

        return $this;
    }

    /**
     * Returns true if offset exists. False otherwise.
     *
     * @param int $offset Offset
     */
    public function offsetExists($offset): bool
    {
        return isset($this->container[$offset]);
    }

    /**
     * Gets offset.
     *
     * @param int $offset Offset
     *
     * @return null|mixed
     */
    public function offsetGet($offset): mixed
    {
        return $this->container[$offset] ?? null;
    }

    /**
     * Sets value based on offset.
     *
     * @param null|int $offset Offset
     * @param mixed    $value  Value to be set
     */
    public function offsetSet($offset, $value): void
    {
        if (is_null($offset)) {
            $this->container[] = $value;
        } else {
            $this->container[$offset] = $value;
        }
    }

    /**
     * Unsets offset.
     *
     * @param int $offset Offset
     */
    public function offsetUnset($offset): void
    {
        unset($this->container[$offset]);
    }
}
