function createQueueToday({ todayWork, todaySync, refresh, warm }) {
  return function queueToday(issue) {
    const added = todayWork.add(issue);
    if (added !== 'added' && added !== 'exists') return added;
    if (added === 'added' && !todaySync.enqueue('add', todayWork.identity(issue))) {
      refresh();
      warm();
      return 'sync-unavailable';
    }
    refresh();
    if (added === 'added') todaySync.flush();
    warm();
    return 'queued';
  };
}

if (typeof module !== 'undefined' && module.exports) module.exports = createQueueToday;
