define([
  'underscore',
  'shared/views/BaseView',
  'shared/views/datalist/DeadSimpleDataList'
], function (_, BaseView, DeadSimpleDataList) {

  var DoneButton = BaseView.extend({

    className: 'simplemodal-button-bar o-form-button-bar',

    template: '<input type="button" data-type="close" \
                      class="button button-primary js-done-button" \
                      value="{{i18n code="simplemodal.done"}}">',

    events: {
      'click .js-done-button': 'doneAssignment'
    },

    doneAssignment: function () {
      this.state.trigger('doneAssignment');
    }

  });

  return DeadSimpleDataList.extend({

    resizeSelector: '.data-list-content-wrap',

    toolbar: [
      {
        type: 'search',
        align: 'left',
        minChars: 1,
        field: 'unassignedSearchQuery'
      }
    ],

    collectionEvents: {
      sync: 'balance',
      itemAssigned: 'itemAssigned'
    },

    postRender: function () {
      this.add(DoneButton);
    },

    itemAssigned: function (assignmentId) {
      var assignment = this.collection.findWhere({id: assignmentId});
      // safe check to avoid nullpoint exception.
      if (assignment) 

    },

    balance: _.debounce(function () {
      DeadSimpleDataList.prototype.balance.apply(this, arguments);
      this.trigger('resize');
    }, this.debounceTime)
  });

});

{
        assignment.set('__isAssigned__', true);
      }