'use strict';

// Core tasks bootstrapped on first run.
// Shared between agent.js and api-walle.js to avoid duplication.
module.exports = [
  {
    title: 'Morning Briefing',
    description: 'Generate a daily morning briefing with calendar, Slack activity, pending tasks, and mentions.',
    type: 'recurring',
    schedule: 'daily at 7am',
    skill: 'morning-briefing',
    priority: 'normal',
  },
  {
    title: 'Sync Calendar',
    description: 'Sync macOS Calendar events (Google, iCloud, Outlook) into Wall-E brain via EventKit.',
    type: 'recurring',
    schedule: 'every 30m',
    skill: 'google-calendar',
    priority: 'normal',
  },
  {
    title: 'Slack: Conversation Sync',
    description: 'Pull latest Slack messages from active conversations into Wall-E brain.',
    type: 'recurring',
    schedule: 'every 15m',
    skill: 'slack-sync',
    priority: 'normal',
  },
  {
    title: 'Email: Conversation Sync',
    description: 'Sync Gmail/Google Workspace emails into Wall-E brain via gws CLI. macOS Mail is not used on this default path.',
    type: 'recurring',
    schedule: 'every 6h',
    skill: 'gws-workspace',
    skill_config: JSON.stringify({ services: 'gmail', gmail_query: 'newer_than:3d', gmail_max_results: 50 }),
    priority: 'normal',
  },
  {
    title: 'Slack: Full History Backfill',
    description: 'One-time full Slack history pull (2022-present). Run manually to backfill all past conversations.',
    type: 'once',
    skill: 'slack-backfill',
    priority: 'normal',
  },
  {
    // Recurring incremental via Gmail API/gws. Mail.app cannot service large
    // JXA queries without going Not Responding, so Mail.app is reserved for
    // explicit fallback/manual backfill only.
    title: 'Email: Sent + Inbox Incremental',
    description: 'Sync sent + inbox emails through Google Workspace Gmail API. Always incremental and does not touch macOS Mail.',
    type: 'recurring',
    schedule: 'every 12h',
    skill: 'gws-workspace',
    skill_config: JSON.stringify({ services: 'gmail', gmail_query: 'in:anywhere newer_than:14d', gmail_max_results: 100 }),
    priority: 'normal',
  },
  {
    title: 'Email: macOS Mail Fallback Backfill',
    description: 'One-time fallback pull from macOS Mail for non-Gmail accounts or emergency recovery. Prefer Google Workspace sync for Gmail/work accounts.',
    type: 'once',
    skill: 'email-sync',
    skill_config: JSON.stringify({ days_back: 3650, sync_inbox: true, full_backfill: true }),
    priority: 'normal',
  },
  {
    title: 'Proactive Alerts',
    description: 'Check for time-sensitive items: upcoming meetings, @mentions, approaching deadlines, failed tasks.',
    type: 'recurring',
    schedule: 'every 5m',
    skill: 'proactive-alerts',
    priority: 'normal',
  },
  {
    title: 'Slack: @walle Mentions',
    description: 'Poll Slack for @walle mentions from the owner. Creates tasks for assignments, replies in-thread for questions.',
    type: 'recurring',
    schedule: 'every 30s',
    skill: 'slack-mentions',
    priority: 'normal',
  },
  {
    title: 'Glean: Team Structure Sync',
    description: 'Sync team structure and contacts from Glean people directory into Wall-E brain.',
    type: 'recurring',
    schedule: 'weekly Monday at 6am',
    skill: 'glean-team-sync',
    priority: 'normal',
  },
  {
    title: 'Weekly Reflection',
    description: 'Generate a weekly reflection analyzing patterns, decisions, and insights from the past 7 days.',
    type: 'recurring',
    schedule: 'weekly Sunday at 8pm',
    skill: 'weekly-reflection',
    priority: 'normal',
  },
];
