SensorData = new Mongo.Collection("sensorData");
ControllerState = new Mongo.Collection("controller_states");
Picture = new Mongo.Collection("pictures");


Meteor.zoblak = {}
Meteor.zoblak.client = {
  controller_state: function() {
    result = ControllerState.findOne({});
    if (!result) {
      result = {}
    };
    return result;
  },

  config: function() {
    Meteor.zoblak.client.controller_state().config
  },

  accessible: function(feature) {
    var controller = Meteor.zoblak.client.controller_state();

    console.log('cotnroller ', controller);
    if (!controller.features) return false;

    return controller.features[feature] === true;
  }
}

Meteor.zoblak.server = {
  controller_state: function(controller_id) {
    var result = {}
    if (controller_id) {
      result = ControllerState.findOne({
        controller_id: controller_id
      });
    }

    if (!result) {
      result = {}
    };
    return result;
  }
}
