'use strict';

/**
 * Licensed Materials - Property of IBM
 * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2016, 2017
 * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
 */
define(['../../../widgets/livewidget/nls/StringResources', '../../../lib/@waca/core-client/js/core-client/ui/core/Class'], function (StringResources, Class) {
	'use strict';

	var topBottomParams = function topBottomParams(topBottom) {
		var retval = {};
		retval.columnLabel = topBottom.limit.factColumnLabel;
		retval.operator = topBottom.limit.op === 'top' ? StringResources.get('topOperator') : StringResources.get('bottomOperator');
		retval.value = topBottom.limit.val;
		retval.percent = topBottom.limit.percent ? '%' : '';
		return retval;
	};

	var operator = {
		fact: {
			template: 'topBottomFact',
			params: function params(topBottom) {
				return topBottomParams(topBottom);
			}
		},
		dimension: {
			template: 'topBottomDimension',
			params: function params(topBottom) {
				return topBottomParams(topBottom);
			}
		}
	};

	var TopBottomLabel = Class.extend({

		getTopBottomLabel: function getTopBottomLabel(topBottom) {
			var op = topBottom.limit && topBottom.limit.fact ? operator.fact : operator.dimension;
			return StringResources.get(op.template, op.params(topBottom));
		}

	});

	return TopBottomLabel;
});
//# sourceMappingURL=TopBottomLabel.js.map