/// class ProspectDirector.Types.View.FilterOperator

ProspectDirector.Types.View.FilterOperator = {

    /* properties */

    "NoFilterSet": 0,
    "Equals": 1,
    "DoesNotEqual": 2,
    "GreaterThanOrEqualTo": 4,
    "GreaterThan": 8,
    "LessThanOrEqualTo": 16,
    "LessThan": 32,
    "IsNull": 64,
    "IsNotNull": 128,
    "StartsWith": 256,
    "EndsWith": 512,
    "Contains": 1024,
    "Has": 2048,
    "DoesNotStartWith": 4096,
    "DoesNotEndWith": 8192,
    "DoesNotContain": 16384,
    "DoesNotHave": 32768,
    "InList": 65536,
    "NotInList": 131072,

    /* private methods */

    _getEnabledHtml: function (enabled) {
        //        if (enabled) {
        //            return "<input type=\"checkbox\" checked/>";
        //        }
        //        else {
        //            return "<input type=\"checkbox\"/>";
        //        }
        return "";
    },

    _getNameHtml: function (name) {
        return "<span style=\"line-height:12px;\">" + name + "</span>";
    },

    _getOperatorHtml: function (flag) {
        if (this.isSet(flag)) {
            return "<span style=\"color:blue;line-height:12px;\">" + this.getName(flag) + "</span>";
        }
        else {
            return "<span style=\"color:darkred;line-height:12px;\">" + this.getName(flag) + "</span>";
        }
    },

    _getValueHtml: function (value, verse, flag) {

        var data = "";

        if (verse && verse.length > 0) {
            data = verse;
        }
        else {
            if (value) {
                data = value;
            }
        }

        return "<span style=\"color:darkgreen;line-height:12px;\">" + data + "</span>";

    },

    /* public methods */

    getName: function (flag) {

        for (prop in this) {
            if (this[prop] === flag) {
                return prop.match(/[A-Z][a-z]+/g).join(" ");
            }
        }

    },

    isValueOperator: function (flag) {

        return flag !== this.NoFilterSet
                && flag !== this.IsNull
                && flag !== this.IsNotNull;

    },

    isVerseOperator: function (flag) {

        return flag === this.InList
                || flag === this.NotInList;
    },

    isSet: function (flag) {
        return flag !== this.NoFilterSet;
    },

    getFilterHtml: function (source) {
        return "" +
                " " + this._getEnabledHtml(source.enabled) +
                " " + this._getNameHtml(source.name) +
                " " + this._getOperatorHtml(source.operator) +
                " " + this._getValueHtml(source.value, source.verse, source.operator) +
                "";
    }

};