var util = require( "util" );
var ClassyBase = require( "./classy" );


module.exports = CreateHandler;


function CreateHandler ( req, res, next ) {

    ClassyBase.call( this, req, res, next );

    this.on( "pre.create", this.preCreate );
    this.on( "create", this.create );
    this.on( "post.create", this.postCreate );

}

util.inherits( CreateHandler, ClassyBase );


CreateHandler.prototype.validate = function() {
    "Emit 'error.validation' and pass errors to send validation error response";
    "Emit 'create' and pass data to invoke 'create' method";
    "Emit 'pre.create' and pass data to invoke 'preCreate' method";
    throw new Error( "Not implemented" );
};


CreateHandler.prototype.preCreate = function( data ) {
    "Emit 'create' and pass data to invoke 'create' method";
    "Emit 'error' and pass error to send error response";
    throw new Error( "Not implemented" );
};


CreateHandler.prototype.create = function( data ) {
    "Emit 'error' and pass error to send error response";
    "Emit 'respond' and pass data to send response";
    "Emit 'post.create' and pass data to invoke 'postCreate' method";
    throw new Error( "Not implemented" );
};


CreateHandler.prototype.postCreate = function( data ) {
    "Emit 'error' and pass error to send error response";
    "Emit 'respond' and pass data to send response";
    throw new Error( "Not implemented" );
};


CreateHandler.prototype.respond = function( data ) {
    this.res.status( 201 ).json( data );
};


CreateHandler.prototype.handle = function() {
    this.validate();
};

@@ -63,16 +63,52 @@
 ssy%22 );%0A
+var errors = require( %22./errors%22 );%0A
 %0A%0Amodule
@@ -405,16 +405,271 @@
 ase );%0A%0A
+CreateHandler.prototype.onData = function( nextEvent ) %7B%0A%0A    var _this = this;%0A%0A    return function ( err, data ) %7B%0A%0A        if ( err ) %7B%0A            return _this.emit( %22error%22, err );%0A        %7D%0A%0A        return _this.emit( nextEvent, data );%0A%0A    %7D;%0A%0A%7D;%0A
 %0ACreateH

Add onData callback method to CreateHandler