import type { CalendarTask } from '@/lib/jmap/types';
import { demoDate } from '../demo-utils';

export function createDemoCalendarTasks(): CalendarTask[] {
  return [
    {
      id: 'demo-task-1',
      calendarIds: { 'demo-calendar-personal': true },
      '@type': 'Task',
      uid: 'demo-task-uid-1',
      title: 'Buy groceries',
      description: 'Milk, bread, eggs, and vegetables',
      due: demoDate(0, 2),
      start: null,
      duration: null,
      timeZone: null,
      showWithoutTime: false,
      progress: 'needs-action',
      progressUpdated: null,
      priority: 0,
      privacy: 'public',
      keywords: null,
      categories: null,
      color: null,
      created: demoDate(-3),
      updated: demoDate(-1),
      recurrenceRules: null,
      alerts: null,
      relatedTo: null,
    },
    {
      id: 'demo-task-2',
      calendarIds: { 'demo-calendar-work': true },
      '@type': 'Task',
      uid: 'demo-task-uid-2',
      title: 'Prepare quarterly report',
      description: 'Compile Q4 metrics and send to team',
      due: demoDate(1, 4),
      start: null,
      duration: null,
      timeZone: null,
      showWithoutTime: false,
      progress: 'in-process',
      progressUpdated: demoDate(-1),
      priority: 1,
      privacy: 'public',
      keywords: null,
      categories: null,
      color: null,
      created: demoDate(-5),
      updated: demoDate(0),
      recurrenceRules: null,
      alerts: {
        'demo-alert-1': {
          '@type': 'Alert',
          trigger: { '@type': 'OffsetTrigger', offset: '-PT15M', relativeTo: 'start' },
          action: 'display',
          acknowledged: null,
          relatedTo: null,
        },
      },
      relatedTo: null,
    },
    {
      id: 'demo-task-3',
      calendarIds: { 'demo-calendar-personal': true },
      '@type': 'Task',
      uid: 'demo-task-uid-3',
      title: 'Schedule dentist appointment',
      description: '',
      due: demoDate(3),
      start: null,
      duration: null,
      timeZone: null,
      showWithoutTime: true,
      progress: 'needs-action',
      progressUpdated: null,
      priority: 5,
      privacy: 'public',
      keywords: null,
      categories: null,
      color: null,
      created: demoDate(-2),
      updated: demoDate(-2),
      recurrenceRules: null,
      alerts: null,
      relatedTo: null,
    },
    {
      id: 'demo-task-4',
      calendarIds: { 'demo-calendar-work': true },
      '@type': 'Task',
      uid: 'demo-task-uid-4',
      title: 'Review pull requests',
      description: 'Review open PRs from the team',
      due: demoDate(-1),
      start: null,
      duration: null,
      timeZone: null,
      showWithoutTime: true,
      progress: 'completed',
      progressUpdated: demoDate(0),
      priority: 0,
      privacy: 'public',
      keywords: null,
      categories: null,
      color: null,
      created: demoDate(-4),
      updated: demoDate(0),
      recurrenceRules: null,
      alerts: null,
      relatedTo: null,
    },
    {
      id: 'demo-task-5',
      calendarIds: { 'demo-calendar-personal': true },
      '@type': 'Task',
      uid: 'demo-task-uid-5',
      title: 'Pay electricity bill',
      description: '',
      due: demoDate(-2),
      start: null,
      duration: null,
      timeZone: null,
      showWithoutTime: true,
      progress: 'needs-action',
      progressUpdated: null,
      priority: 1,
      privacy: 'public',
      keywords: null,
      categories: null,
      color: null,
      created: demoDate(-7),
      updated: demoDate(-7),
      recurrenceRules: null,
      alerts: null,
      relatedTo: null,
    },
  ];
}
