/**
 * Abstract component for apeman framework.
 * @constructor ApComponent
 */

"use strict";

var React = require('react'),
    extend = require('extend'),
    iftype = require('iftype');

/** @lends ApComponent */
var ApComponent = React.createClass(
    {
        getInitialState: function () {
            return {};
        },
        getDefaultProps: function () {
            return {};
        },
        propTypes: {},
        mixins: [],
        statics: [],
        render: function () {
            throw new Error('Not implemented!');
        }
    }
);

/**
 * Define a component.
 * @function ApComponent.define
 * @param {object} spec
 * @returns {*|Function}
 */
ApComponent.define = function (spec) {
    var Component = React.createClass(spec);
    var prototype = Component.prototype;
    Component.prototype = ApComponent;
    extend(Component.prototype, prototype);
    Component.prototype.constructor = Component;
    return Component;
};

module.exports = ApComponent;

