 util           = require 'util'
 {EventEmitter} = require 'events'
 debug          = require('debug')('meshblu-splunk-event-collector')
-_              = require 'lodash'
 
 
 ERROR_BASE_URL_INVALID = "SplunkEventUrl is undefined or invalid"

     )

  onConfig: (device) =>
    self = @
    @setOptions device.options
    if ( !_.isEqual subscribeList, device.options.subscribeList )
      removeList = _.difference subscribeList, device.options.subscribeList
      addList = _.difference device.options.subscribeList, subscribeList
      subscribeList = device.options.subscribeList

      if removeList?
        _.each removeList, (unsubDevice)->
          debug 'unsubscribed', unsubDevice
          self.emit 'unsubscribe', {uuid: unsubDevice}
      if addList?
        _.each addList, (subDevice) ->
          debug 'subscribed', subDevice
          self.emit 'subscribe', {uuid: subDevice}

  setOptions: (options={}) =>
    @options = options

    SplunkEventUrl:
      type: 'string'
      required: true


class Plugin extends EventEmitter
