$ = jQuery
context = window
logger = context.JK.logger

@SubjectStore = Reflux.createStore(
  {
    listenables: @SubjectActions
    subjects: []
    subjectLookup: {}

    init: ->
      # Register with the app store to get @app
      this.listenTo(context.AppStore, this.onAppInit)

    onAppInit: (@app) ->
      rest.getSubjects().done (subjects) =>
        @subjects = subjects
        for subject in subjects
          @subjectLookup[subject.id] = subject.description

        @trigger(@subjects)

    display: (id)  ->
      @subjectLookup[id]

  }
)
