/*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.defineTransition('asignee', {
    description: 'Get the person this object is assigned to',

    // action: function() {
    //   Find the person in its repository
    // },

    method: 'GET'
  });

  generator.addState('todos/:id', {
    type: 'entity',

    attributes: {
      // Title of the state
      title: { type: 'string', required: true },

      // User ID of the person this is assigned to
      asignee: { type: 'string' }
    },

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

  generator.addState('people/:id', {
    type: 'entity',

    attributes: {
      name: { type: 'string', required: true }
    }
  });

  generator.addState('todos', {
    type: 'repository',

    collectionName: 'todos',
    perPage: 10,

    transitions: [
      { to: 'todos/:id', via: 'contains' }
    ]
  });
}());

/*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.defineTransition('asignee', {
    description: 'Get the person this object is assigned to',

    // action: function() {
    //   Find the person in its repository
    // },

    method: 'GET'
  });

  generator.addState('todos/:id', {
    type: 'entity',

    attributes: {
      // Title of the state
      title: { type: 'string', required: true },

      // User ID of the person this is assigned to
      asignee: { type: 'string' }
    },

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

  generator.addState('people/:id', {
    type: 'entity',

    attributes: {
      name: { type: 'string', required: true }
    }
  });

  generator.addState('todos', {
    type: 'repository',

    collectionName: 'todos',
    perPage: 10,

    transitions: [
      { to: 'todos/:id', via: 'contains' }
    ]
  });

  generator.addState('people', {
    type: 'repository',

    collectionName: 'people',
    perPage: 10,

    transitions: [
      { to: 'people/:id', via: 'contains' }
    ]
  });
}());

Add a repository for people
Add a repository for people
