"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "SimpleChatStore", {
    enumerable: true,
    get: function() {
        return SimpleChatStore;
    }
});
class SimpleChatStore {
    store = {};
    setMessages(key, messages) {
        this.store[key] = messages;
    }
    getMessages(key) {
        return this.store[key] || [];
    }
    addMessage(key, message) {
        this.store[key] = this.store[key] || [];
        this.store[key].push(message);
    }
    deleteMessages(key) {
        if (!(key in this.store)) {
            return null;
        }
        const messages = this.store[key];
        delete this.store[key];
        return messages;
    }
    deleteMessage(key, idx) {
        if (!(key in this.store)) {
            return null;
        }
        if (idx >= this.store[key].length) {
            return null;
        }
        return this.store[key].splice(idx, 1)[0];
    }
    deleteLastMessage(key) {
        if (!(key in this.store)) {
            return null;
        }
        const lastMessage = this.store[key].pop();
        return lastMessage || null;
    }
    getKeys() {
        return Object.keys(this.store);
    }
}
