/*jslint indent: 2, nomen: true, maxlen: 100 */
/*global require, applicationContext */

(function () {
  "use strict";
  var FoxxGenerator = require('./foxx_generator').Generator,
    generator;

  generator = new FoxxGenerator({
    mediaType: 'application/vnd.api+json',
    applicationContext: applicationContext,
  });

  generator.addState('todos', {
    attributes: {
      title: { type: 'string', required: true }
    },

    transitions: [
      { to: 'people', via: 'AssignedTo' }
    ]
  });

  generator.addState('people', {
    attributes: {
      name: { type: 'string', required: true }
    }
  });

  generator.addTransition('AssignedTo', {
    relation: 'assignedTo',
    description: 'Get the person this object is assigned to',
    // parameters: {},

    // condition: function(environment) {
    //   return environment.currentUser === this.to.owner;
    // },

    // action: function() { this.to.destroy();
    // },

    method: 'GET'
  });

  generator.addRepository('TodoRepository', {
    contains: 'todos',

    // Should be:
    // transitions: [
    //   { to: 'todos', via 'Contains' }
    // ]

    collectionName: 'todos',
    per_page: 10
  });
}());

/*jslint indent: 2, nomen: true, maxlen: 100 */
/*global require, applicationContext */

(function () {
  "use strict";
  var FoxxGenerator = require('./foxx_generator').Generator,
    generator;

  generator = new FoxxGenerator({
    mediaType: 'application/vnd.api+json',
    applicationContext: applicationContext,
  });

  generator.addState('todos/:id', {
    attributes: {
      title: { type: 'string', required: true }
    },

    transitions: [
      { to: 'people', via: 'AssignedTo' }
    ]
  });

  generator.addState('people/:id', {
    attributes: {
      name: { type: 'string', required: true }
    }
  });

  generator.addTransition('AssignedTo', {
    relation: 'assignedTo',
    description: 'Get the person this object is assigned to',
    // parameters: {},

    // condition: function(environment) {
    //   return environment.currentUser === this.to.owner;
    // },

    // action: function() { this.to.destroy();
    // },

    method: 'GET'
  });

  generator.addRepository('todos', {
    contains: 'todos/:id',

    // Should be:
    // transitions: [
    //   { to: 'todos/:id', via: 'Contains' }
    // ],

    collectionName: 'todos',
    per_page: 10
  });
}());

Clarify names of states