ProspectDirector.Web.UI.Queries.FilterOperator = Class.extend({

    //================================
    // PUBLIC METHODS
    //================================

    getNameMarkup: function (source) {
        return "<span style=\"line-height:12px;\">" + source.columnName + "</span>";
    },

    getScalarFunctionMarkup: function (source) {
        return source.scalarFunctionName ? "<span style=\"color:darkred;line-height:12px;\">" + source.scalarFunctionName + " of </span>" : "";
    },

    getOperatorMarkup: function (source) {
        return "<span style=\"color:" + this.getOperatorColor(source.operator) + ";line-height:12px;\">" + this.getOperatorText(source.operatorName) + "</span>";
    },

    getValueMarkup: function (source) {
        if (source.autoValueId) {
            return "<span style=\"color:darkorange;line-height:12px;\">" + source.autoValueName + "</span>";
        }
        else {
            return "<span style=\"color:darkgreen;line-height:12px;\">" + this.getValueText(source) + "</span>";
        }
    },

    getValueText: function (source) {

        if (source.verse && source.verse.length > 0) {
            return source.verse;
        }

        if (source.value) {
            return source.value;
        }

        return "";

    },

    getOperatorColor: function (operator) {
        return operator === 0 ? "darkred" : "blue";
    },

    getOperatorText: function (operatorName) {
        return operatorName || "No Filter Set";
    }

});

//================================
// STATIC METHODS
//================================

ProspectDirector.Web.UI.Queries.FilterOperator.toMarkup = function (source) {
    
    var instance = new ProspectDirector.Web.UI.Queries.FilterOperator();

    return instance.getScalarFunctionMarkup(source) + 
        " " + instance.getNameMarkup(source) +
        " " + instance.getOperatorMarkup(source) +
        " " + instance.getValueMarkup(source);

};