"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.StandupGenerator = void 0;
class StandupGenerator {
    entries = [];
    generateDaily(completed, inProgress, blocked, plan) {
        const today = new Date().toISOString().split('T')[0];
        const existingIdx = this.entries.findIndex(e => e.date === today);
        const entry = {
            date: today,
            completed,
            inProgress,
            blocked,
            plan,
        };
        if (existingIdx >= 0) {
            this.entries[existingIdx] = entry;
        }
        else {
            this.entries.push(entry);
        }
        return entry;
    }
    formatStandup(entry) {
        let standup = `📋 Standup — ${entry.date}\n\n`;
        standup += `✅ Completed:\n`;
        for (const item of entry.completed) {
            standup += `   • ${item}\n`;
        }
        standup += `\n🔄 In Progress:\n`;
        for (const item of entry.inProgress) {
            standup += `   • ${item}\n`;
        }
        if (entry.blocked.length > 0) {
            standup += `\n🚫 Blocked:\n`;
            for (const item of entry.blocked) {
                standup += `   • ${item}\n`;
            }
        }
        standup += `\n📅 Plan for today:\n`;
        for (const item of entry.plan) {
            standup += `   • ${item}\n`;
        }
        return standup;
    }
    formatSlackMessage(entry) {
        let msg = `*📋 Standup — ${entry.date}*\n\n`;
        msg += `*✅ Completed:*\n`;
        for (const item of entry.completed) {
            msg += `• ${item}\n`;
        }
        msg += `\n*🔄 In Progress:*\n`;
        for (const item of entry.inProgress) {
            msg += `• ${item}\n`;
        }
        if (entry.blocked.length > 0) {
            msg += `\n*🚫 Blocked:*\n`;
            for (const item of entry.blocked) {
                msg += `• ${item}\n`;
            }
        }
        msg += `\n*📅 Plan:*\n`;
        for (const item of entry.plan) {
            msg += `• ${item}\n`;
        }
        return msg;
    }
    getHistory(days = 5) {
        return this.entries.slice(-days);
    }
    getWeeklySummary() {
        const recent = this.getHistory(7);
        if (recent.length === 0)
            return 'No standup entries this week.';
        const allCompleted = recent.flatMap((e) => e.completed);
        const uniqueCompleted = [...new Set(allCompleted)];
        return `This week: ${recent.length} standups, ${uniqueCompleted.length} unique items completed.`;
    }
    clear() {
        this.entries = [];
    }
}
exports.StandupGenerator = StandupGenerator;
//# sourceMappingURL=standup-generator.js.map