/* jshint node: true */
'use strict';

var self;

module.exports = self = {
	// product catalog 
	getXpathForProductCards: function() {
		return '//*[contains(@class,"product-card") and not(.//*[contains(@class,"group")]) and not(contains(@class,"card-small")) ]';
	},
	getXpathForGroupCards: function() {
		return '//*[contains(@class,"product-card") and .//*[contains(@class,"group")] ]';
	},
	getXpathForFieldValueOfGroupCards: function() {
		return '//*[contains(@class,"product-card") and .//*[contains(@class,"group")] ]//h3[contains(@class,"product-name")]';
	},
	getXpathForFirstGroupCard: function() {
		return '(//*[contains(@class,"product-card") and .//*[contains(@class,"group")] ])[1]';
	},
	getXpathForClosingButtonForFilteringSidebar: function() {
		return '(//*[contains(@class,"filter-sidebar")]//i[contains(@class,"pull-right") and contains(@class,"glyphicon-remove")])[1]';
	},
	// product catalog - breadcrumb
	getXpathForActiveGroupClosingButton: function() {
		return '//p[contains(@class,"active-groups")]//span[contains(@class,"glyphicon-remove")]';
	},
	getXpathForActiveFilters: function() {
		return '//p[contains(@class,"active-filters")]/span[contains(@class,"filter-label")]';
	},
	getXpathForFilterClosingButton: function() {
		return '//p[contains(@class,"active-filters")]/span[contains(@class,"filter-label")]/button';
	},
	// product catalog - filtering sidebar
	getXpathForFilter: function(filterName, filterValue) {
		return '//*[contains(@class,"panel-heading") and ./descendant::*[contains(text(),"' + filterName + '")]]/following-sibling::*//label[contains(text(),"' + filterValue + '")]';
	},
	getXpathForNumberOfReviewsOfFirstGroup: function() {
		return '//*[contains(@class,"product-card") and .//*[contains(@class,"group")] ]//div[contains(@class,"product-stats")]//span[contains(@class,"subicon-counter")]';
	},
	getXpathForFiltersByCountry: function() {
		return '//*[contains(@class,"panel-heading") and ./descendant::*[contains(text(),"countries")]]/following-sibling::*//label';
	},
	getXpathForMoreFiltersByCountry: function() {
		return '//*[contains(@class,"panel-heading") and ./descendant::*[contains(text(),"countries")]]/following-sibling::*//a[contains(text(),"Load more")]';
	},
	getXpathForLessFiltersByCountry: function() {
		return '//*[contains(@class,"panel-heading") and ./descendant::*[contains(text(),"countries")]]/following-sibling::*//a[contains(text(),"Load less")]';
	},
	getXpathForRemovingFirstActiveFilter: function() {
		return '//p[contains(@class,"active-filters")]//span[contains(@class,"glyphicon-remove")]';
	},
	// product catalog - navbar
	getXpathForCompareButton: function() {
		return '(//button[contains(@class,"navbar-compare")])[1]';
	},
	// product catalog - tag category mode
	getCssSelectorOfSwitcher: function() {
		return '.switch.tag-category';
	},
	getCssSelectorOfSwitcherCheckbox: function() {
		return '.switch.tag-category > input';
	},
	// comparison - sidebar
	getXpathForBackToProductListButtonFromSidebar: function() {
		return '(//a[contains(@class,"back-button")])[1]';
	},
	getXpathForColoredStartsInSidebarByProductIndex: function(index) {
		index = (index === 1) ? 'one' : 'two';
		return '//*[contains(@class,"comparison-box")]//*[contains(@class,"product-' + index + '") and contains(@class,"product-group")]//span[contains(@class,"glyphicon-star") and contains(@class,"active")]';
	},
	getXpathForNotColoredStartsInSidebarByProductIndex: function(index) {
		index = (index === 1) ? 'one' : 'two';
		return '//*[contains(@class,"comparison-box")]//*[contains(@class,"product-' + index + '") and contains(@class,"product-group")]//span[contains(@class,"glyphicon-star") and not(contains(@class,"active"))]';
	},
	// comparison - product catalog
	getXpathForSidebarCompareButton: function() {
		return '(//div[contains(@class,"sidebar")]//button[contains(@class,"compare-button")])[1]';
	},
	getXpathSelectorForFirstProductCard: function() {
		return '//div[contains(@class,"chart")]//*[contains(@class,"product-card") and not(.//*[contains(@class,"group")]) ]';
	},
	getXpathSelectorForFirstCompareButton: function() {
		return '(//*[contains(@class,"product-card") and not(.//*[contains(@class,"group")]) ]//button[contains(text(),"Compare")])[1]';
	},
	getXpathSelectorForFirstGroupCard: function() {
		return '//div[contains(@class,"product-card") and .//*[contains(@class,"group")] ]';
	},
	getXpathSelectorForFirstGroupCompareButton: function() {
		return '(//*[contains(@class,"product-card") and .//*[contains(@class,"group")] ]//button[contains(text(),"Compare")])[1]';
	}
};