 class Subjects
   queue: []
   api: null
+  current: null
   query:
     sort: 'queued'
     page_size: "30"

    @query.workflow_id = @project?.links.workflows[0]
    @query.subject_set_id = @subject_set_id
    
  current: ->
    @queue[0]
    
  fetch: ->
    return Promise.resolve [] unless @query.workflow_id? && @query.subject_set_id?
    @api.type('subjects')

  
  flush: ->
    subject = null for subject in @queue
    @current = null
    @queue = []
    
  next: ->
    @current = @queue.shift()
    @fetch() if @queue.length < 2
    @current

module.exports = Subjects