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

@GenreStore = Reflux.createStore(
  {
    listenables: @GenreActions
    genres: []
    genresLookup: {}

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

    onAppInit: (@app) ->
      rest.getGenres().done (genres) =>
        @genres = genres
        for genre in genres
          @genresLookup[genre.id] = genre.description

        @trigger(@genres)

    display: (id)  ->
      @genresLookup[id]
  }
)
