'use babel'

import {CompositeDisposable, Emitter} from 'atom'
import BottomTab from './bottom-tab'
import BottomStatus from './bottom-status'

export default class BottomContainer extends HTMLElement {
  createdCallback() {
    this.subscriptions = new CompositeDisposable
    this.emitter = new Emitter
    this.tabs = new Map()
    this.tabs.set('Line', BottomTab.create('Line'))
    this.tabs.set('File', BottomTab.create('File'))
    this.tabs.set('Project', BottomTab.create('Project'))
    this.status = new BottomStatus

    this.subscriptions.add(this.emitter)
    this.subscriptions.add(atom.config.observe('linter.displayLinterInfo', displayInfo => {
      this.visibility = displayInfo
    }))

    // TODO: statusIconScope config
    for (let tab of this.tabs) {
      this.appendChild(tab[1])
    }

    this.onDidChangeTab(activeName => {
      this.activeTab = activeName
    })
  }
  getTab(name) {
    return this.tabs.get(name)
  }
  setCount({Project, File, Line}) {
    this.tags.get('Project').count = Project
    this.tags.get('File').count = File
    this.tags.get('Line').count = Line
    // TODO: Status icon count
  }

  set activeTab(activeName) {
    this._activeTab = activeName
    for (let [name, tab] of this.tabs) {
      tab.active = name === activeName
    }
  }
  get activeTab() {
    return this._activeTab
  }

  get visibility() {
    return !this.hasAttribute('hidden')
  }
  set visibility(value) {
    if (value) {
      this.removeAttribute('hidden')
    } else {
      this.setAttribute('hidden', true)
    }
  }

  onDidChangeTab(callback) {
    const disposable = new CompositeDisposable
    this.tabs.forEach(function(tab) {
      disposable.add(tab.onDidChangeTab(callback))
    })
    return disposable
  }
  onShouldTogglePanel(callback) {
    const disposable = new CompositeDisposable
    this.tabs.forEach(function(tab) {
      disposable.add(tab.onShouldTogglePanel(callback))
    })
    return disposable
  }

  dispose() {
    this.subscriptions.dispose()
  }

  static create() {
    return document.createElement('linter-bottom-container')
  }
}

document.registerElement('linter-bottom-container', {
  prototype: BottomContainer.prototype
})

@@ -703,44 +703,194 @@
 %7D))%0A
-%0A
     
-// TODO: statusIconScope config
+this.subscriptions.add(atom.config.observe('linter.statusIconScope', iconScope =%3E %7B%0A      this.iconScope = iconScope%0A      this.status.count = this.tabs.get(iconScope).count%0A    %7D))%0A
 %0A   
@@ -955,16 +955,50 @@
 %5D)%0A    %7D
+%0A    this.appendChild(this.status)
 %0A%0A    th
@@ -1171,25 +1171,25 @@
 %0A    this.ta
-g
+b
 s.get('Proje
@@ -1216,25 +1216,25 @@
 %0A    this.ta
-g
+b
 s.get('File'
@@ -1259,17 +1259,17 @@
  this.ta
-g
+b
 s.get('L
@@ -1295,29 +1295,58 @@
     
-// TODO: Status icon 
+this.status.count = this.tabs.get(this.iconScope).
 coun

Add statusIconScope observer in container