<?php
namespace boru\ai\Persistence;

use boru\ai\Conversation\Conversation;
use boru\ai\Conversation\ConversationReference;
use boru\ai\Conversation\Turn;

interface PersistenceProviderInterface
{
    /**
     * Load an existing conversation by normalized reference data.
     *
     * @param ConversationReference $reference
     * @return Conversation|false
     */
    public function loadConversation(ConversationReference $reference);

    /**
     * Create or update the base conversation record.
     *
     * @param Conversation $conversation
     * @return Conversation
     */
    public function saveConversation(Conversation $conversation);

    /**
     * Persist a turn for the given conversation.
     *
     * @param Conversation $conversation
     * @param Turn $turn
     * @return Turn
     */
    public function saveTurn(Conversation $conversation, Turn $turn);
}
