/**
 * Niche Channels & Misc
 * Lightweight stubs for Twitch, Tlon, Gmail, and docs search.
 */
import { logger } from '../utils/logger.js';
export class TwitchAdapter {
    running = false;
    channels = new Set();
    config;
    constructor(config = {}) {
        this.config = config;
    }
    start() {
        this.running = true;
        logger.debug('TwitchAdapter started');
    }
    stop() {
        this.running = false;
        this.channels.clear();
        logger.debug('TwitchAdapter stopped');
    }
    isRunning() {
        return this.running;
    }
    sendMessage(channel, text) {
        if (!this.running)
            throw new Error('Adapter not running');
        logger.debug(`Twitch [${channel}]: ${text}`);
        return { sent: true, channel };
    }
    joinChannel(channel) {
        this.channels.add(channel);
    }
    leaveChannel(channel) {
        this.channels.delete(channel);
    }
    getConfig() {
        return { ...this.config };
    }
}
export class TlonAdapter {
    running = false;
    config;
    constructor(config = {}) {
        this.config = config;
    }
    start() {
        this.running = true;
        logger.debug('TlonAdapter started');
    }
    stop() {
        this.running = false;
        logger.debug('TlonAdapter stopped');
    }
    isRunning() {
        return this.running;
    }
    sendMessage(shipName, text) {
        if (!this.running)
            throw new Error('Adapter not running');
        logger.debug(`Tlon [${shipName}]: ${text}`);
        return { sent: true, ship: shipName };
    }
    getConfig() {
        return { ...this.config };
    }
}
export class GmailWebhookAdapter {
    running = false;
    messages = [];
    config;
    constructor(config = {}) {
        this.config = config;
    }
    start() {
        this.running = true;
        logger.debug('GmailWebhookAdapter started');
    }
    stop() {
        this.running = false;
        logger.debug('GmailWebhookAdapter stopped');
    }
    isRunning() {
        return this.running;
    }
    getMessages(limit) {
        const msgs = [...this.messages];
        return limit ? msgs.slice(0, limit) : msgs;
    }
    markRead(messageId) {
        const msg = this.messages.find(m => m.id === messageId);
        if (msg) {
            msg.read = true;
            return true;
        }
        return false;
    }
    getConfig() {
        return { ...this.config };
    }
    // Test helper to add messages
    _addMessage(id, subject) {
        this.messages.push({ id, subject, read: false });
    }
}
export class DocsSearchTool {
    docs = new Map();
    constructor() {
        // Pre-populate with some default topics
        this.docs.set('getting-started', { content: 'Install and configure Code Buddy', url: '/docs/getting-started' });
        this.docs.set('tools', { content: 'Available tools and their usage', url: '/docs/tools' });
        this.docs.set('configuration', { content: 'Configuration options and environment variables', url: '/docs/configuration' });
    }
    search(query) {
        const results = [];
        const queryLower = query.toLowerCase();
        for (const [topic, doc] of this.docs) {
            if (topic.includes(queryLower) || doc.content.toLowerCase().includes(queryLower)) {
                results.push({ topic, snippet: doc.content, url: doc.url });
            }
        }
        return results;
    }
    getTopics() {
        return Array.from(this.docs.keys());
    }
    getDocUrl(topic) {
        return this.docs.get(topic)?.url;
    }
}
//# sourceMappingURL=niche-channels.js.map