(function (paw, utils) {

    function DocumentMetadataLookupTpl(setterType, setterValueField, localization) {
        this.setterType = setterType;
        this.displayProperties = [];
        this.resultField = null;
        this.setterValueField = setterValueField;
        this.localization = localization;
    }

    DocumentMetadataLookupTpl.prototype.header = function (item) {
        return this.headerMarkup(item).join('\n');
    };

    DocumentMetadataLookupTpl.prototype.row = function (item) {
        return this.rowMarkup(item).join('\n');
    };

    DocumentMetadataLookupTpl.prototype.headerMarkup = function (item) {
        // OVERRIDE IN CHILD (below is default header markup)
        var self = this;
        var markup = [];
        utils.iterable.iterate(this.displayProperties, function (prop) {
            markup.push([
                '<td>',
                '   <span>' + (utils.value.isSet(self.localization[prop]) ? self.localization[prop] : '') + '</span>',
                '</td>'
            ].join('\n'))
        });
        return markup;
    };

    DocumentMetadataLookupTpl.prototype.rowMarkup = function (item) {
        // OVERRIDE IN CHILD (below is default row markup)
        var markup = [];
        utils.iterable.iterate(this.displayProperties, function (prop) {
            markup.push([
                '<td>',
                '   <span>' + item[prop] + '</span>',
                '</td>'
            ].join('\n'));
        });
        return markup;
    };

    paw.com.documentMetadata.DocumentMetadataLookupTpl = DocumentMetadataLookupTpl;
})(paw, paw.utils);