import api from './index'

/**
 * Daily Digest API
 */

export async function getDailyDigest(date) {
  return api.get(`/api/memory/daily-digest/${date}`)
}

export async function getRecentDigests(limit = 7) {
  return api.get('/api/memory/daily-digests', { params: { limit } })
}

/**
 * Reminder API
 */

export async function createReminder(content, triggerAt, triggerType = 'time') {
  return api.post('/api/memory/reminders', {
    content,
    trigger_at: triggerAt,
    trigger_type: triggerType,
  })
}

export async function snoozeReminder(id, minutes) {
  return api.post(`/api/memory/reminders/${id}/snooze`, { minutes })
}

export async function dismissReminder(id) {
  return api.delete(`/api/memory/reminders/${id}`)
}

export async function getDueReminders() {
  return api.get('/api/memory/reminders/due')
}
