import Ember from 'ember';
import DS from 'ember-data';
import _ from 'npm:lodash';

var Operator = DS.Model.extend({
	feeds: DS.hasMany('feed', { async: true }),
	identifiers: DS.attr(),
	name: DS.attr('string'),
	short_name: DS.attr('string'),
	onestop_id: Ember.computed.alias('id'),
	country: DS.attr('string'),
	state: DS.attr('string'),
	metro: DS.attr('string'),
	website: DS.attr('string'),
	timezone: DS.attr('string'),
	created_at: DS.attr('date'),
	updated_at: DS.attr('date'),
	toChangeset: function() {
		var operatorJson = this.toJSON();
		operatorJson.onestopId = this.id;
		// remove attributes that don't need to be submitted to server
		operatorJson = _.omit(operatorJson, ['created_at', 'updated_at', 'feeds']);
		// remove any attributes with null values, undefined values, or empty strings
		operatorJson = _.omit(operatorJson, function(value) {
			return value === null || value === '' || value === undefined;
		});

		var changeset = this.store.createRecord('changeset', {
			notes: 'This is a test. TODO put a custom message here.',
			payload: {
				changes: [
					{
						action: 'createUpdate',
						operator: operatorJson
					}
				]
			}
		});
		return changeset;
	}
});


export default Operator;

@@ -482,16 +482,58 @@
 date'),%0A
+  geometry: DS.attr(),%0A  tags: DS.attr(),%0A
 %09toChang
@@ -533,19 +533,16 @@
 toChange
-set
 : functi

Add geometry and tags to Operator model