const modNotesDb = require('./modNotes.db')

async function listForUser(discordId, { includeAdminOnly = false } = {}) {
  return modNotesDb.listForUser(discordId, { includeAdminOnly })
}

async function add({ discordUserId, author, body, visibility = 'staff_only' }) {
  const id = await modNotesDb.insert({
    discordUserId,
    authorUserId: author ? author.id : null,
    authorTag: author ? author.username : null,
    body,
    visibility,
  })
  return modNotesDb.getById(id)
}

module.exports = { listForUser, add }
