
var React = require('react');

var ModuleStatus = React.createClass({
    displayName: 'ModuleStatus',
    mixins: [
        require('bd-stampy/mixins/ClassMixin')
    ],
    propTypes: {
        status: React.PropTypes.string
    },
    getDefaultProps() {
        return {
            status: 'INCOMPLETE'  
        };
    },
    render: function () {
        var {status, type} = this.props;

        var statusTable = {
            COMPLETED: {
                color: 'green',
                text: 'Complete'
            },
            IN_PROGRESS: {
                color: 'yellow',
                text: 'In Progress'
            },
            INCOMPLETE: {
                color: 'muted',
                text: 'Incomplete'
            }
        };

        var classes = this.createClassName(type)
            .modifier(statusTable[status].color)
            .add(`t-${statusTable[status].color}`);

        return <span {...this.props} className={classes.className}>{statusTable[status].text}</span>;
    }
});

module.exports = ModuleStatus;