 SignInPrompt = require '../../partials/sign-in-prompt'
 seenThisSession = require '../../lib/seen-this-session'
 
+FAILED_CLASSIFICATION_QUEUE_NAME = 'failed-classifications'
+
 PROMPT_TO_SIGN_IN_AFTER = [5, 10, 25, 50, 100, 250, 500]
 
 SKIP_CELLECT = location?.search.match(/\Wcellect=0(?:\W|$)/)?

    console?.info 'Completed classification', @state.classification
    savingClassification = if @state.demoMode
      Promise.resolve @state.classification
    else
      @state.classification.save()

    savingClassification.then (classification) =>
      if @state.demoMode
        console?.log 'Demo mode: Did NOT save classification'
      else
        console?.log 'Saved classification', classification.id
        Promise.all([
          classification.get 'workflow'
          classification.get 'subjects'
        ]).then ([workflow, subjects]) ->
          seenThisSession.add workflow, subjects
          classification.destroy()
      classificationsThisSession += 1
      @maybePromptToSignIn()

  maybePromptToSignIn: ->
    if classificationsThisSession in PROMPT_TO_SIGN_IN_AFTER and not @props.user?

  getDefaultProps: ->
    query: null
    project: null
    simulateSaveFailure: (location?.search ? '').indexOf('simulate-classification-save-failure') isnt -1

  getInitialState: ->
    workflow: null
