/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \
|		
|		Copyright (c) 2007 Prosodie
|		Author BILLIOT Clement
|		SeoData javascript librairies
|		
\ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/**
 * @author cbilliot
 * @version 0.1
 * @fileoverview Javascript librairies useful to get datas from the ecommerce website (products, orders, pages, cart information, etc...)
 * @ 
 * */


/**
 * Page info constructor
 * @class Page info constructor
 * @param {String} pageName The current page name
 * @constructor
 */
function SeoDataJs(pageName) {
	this.pageName=pageName;	
}

/**
 * Order info constructor
 * @class Order info constructor
 * @param String orderId The current page name
 * @param String orderTotal The total order
 * @constructor
 */
function SeoDataOrderJs(orderId, orderTotal, orderShipping, orderCity, orderPostalCode, orderCountry, orderPayment, orderPromoCode) {
	this.orderId=orderId;	
	this.orderTotal=orderTotal;	
	this.orderShipping=orderShipping;	
	this.orderCity=orderCity;
	this.orderPostalCode=orderPostalCode;
	this.orderCountry=orderCountry;
	this.orderPayment=orderPayment;
	this.orderPromoCode=orderPromoCode;
}

/**
 * Product info constructor
 * @class Product info constructor
 * @param String productId The productId
 * @param String productName The product name
 * @param String productPrice The product price
 * @constructor
 */	
function SeoDataProductJs(productId, productName, productPrice) {
	this.productId=productId;
	this.productName=productName;
	this.productPrice=productPrice;
}

/**
 * Category info constructor
 * @class Category info constructor
 * @param String categoryId The categoryId
 * @param String categoryName The category name
 * @constructor
 */
function SeoDataCategoryJs(categoryId, categoryName, subCategoryId, subCategoryName) {
	this.categoryId=categoryId;
	this.categoryName=categoryName;
	this.subCategoryId=subCategoryId;
	this.subCategoryName=subCategoryName;	
}

/**
 * Cart Item info constructor
 * @class Cart Item info constructor
 * @param String productId The cart item productId
 * @param String name The product name
 * @param String description The product description
 * @param String parentCategory The parent category
 * @param String price The product price
 * @param String quantity The cart item quantity
 * @constructor
 */
function SeoDataCartItemJs(productId, name, description, parentCategory, price, quantity) {
	this.productId=productId;
	this.name=name;
	this.description=description;
	this.parentCategory=parentCategory;
	this.price=price;
	this.quantity=quantity;
}

/**
 * User info constructor
 * @class User info constructor
 * @param String title The user's title
 * @param String lastName The user's lastName
 * @param String firstName The user's firstName
 * @param String streetNumber The user's street number 
 * @param String address The user's address
 * @param String postalCode The user's postal code
 * @param String city The user's city
 * @param String phoneNumber The user's phone number
 * @param String email The user's email
 * @constructor
 */
function SeoDataUserJs(id, title, lastName, firstName, streetNumber, address, postalCode, city, country, phoneNumber, email) {
	this.id=id;
	this.title=title;
	this.lastName=lastName;
	this.firstName=firstName;
	this.streetNumber=streetNumber;
	this.address=address;
	this.postalCode=postalCode;
	this.city=city;
	this.country=country;
	this.phoneNumber=phoneNumber;
	this.email=email;
	this.toString = function toStringUser(){
		document.write(this.title+" "+this.lastName+" "+this.firstName);
	}	
}

/**
 * Keyword info constructor
 * @class Keyword info constructor
 * @param String keywords The entered keywords
 */
function SeoDataKeywordJs(keywords) {
	this.keywords=keywords;
}

/**
 * Store info constructor
 * @class Store info constructor
 * @param String country The selected country
 * @param String city The selected city
 */
function SeoDataStoreJs(storeCountry,storeCity) {
	this.storeCountry=storeCountry;
	this.storeCity=storeCity;
}

/**
 * Cart info constructor
 * @class Cart info constructor
 * @param String total The cart total
 * @param String subTotal The cart subTotal
 * @param String shipping The cart shipping
 */
function SeoDataCartJs(total,subTotal,shipping,promoCode) {
	this.total=total;
	this.subTotal=subTotal;
	this.shipping=shipping;
	this.promoCode=promoCode;
}

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  \
|		Hitbox Use Case
\ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

/**
 * formatIdItemsHBX
 * CartItem formatting for Hitbox
 * @class CartItems formatting for Hitbox
 * @param Array of seoDataCarItem 
 * @type String 
 * @see #SeoDataCarItem
 */
 function formatIdItemsHBX(seoDataCartItems) {
 	var idItemsHBXStr = "";
 	for(var i in seoDataCartItems) {
 		if (i > 0) idItemsHBXStr = idItemsHBXStr + ",";
 		var seoDataCartItem = seoDataCartItems[i];
 		idItemsHBXStr = idItemsHBXStr + seoDataCartItem.productId;
 	}
 	return idItemsHBXStr;
 }

/**
 * formatPriceItemsHBX
 * CartItem formatting for Hitbox
 * @class CartItems formatting for Hitbox
 * @param Array of seoDataCarItem 
 * @type String 
 * @see #SeoDataCarItem
 */
 function formatPriceItemsHBX(seoDataCartItems) {
 	var priceItemsHBXStr = "";
 	for(var i in seoDataCartItems){
 		if (i > 0) priceItemsHBXStr = priceItemsHBXStr + ",";
 		var seoDataCartItem = seoDataCartItems[i];
 		priceItemsHBXStr = priceItemsHBXStr + seoDataCartItem.price;
 	}
 	return priceItemsHBXStr;
 }

/**
 * formatQuantityItemsHBX
 * CartItem formatting for Hitbox
 * @class CartItems formatting for Hitbox
 * @param Array of seoDataCarItem 
 * @type String 
 * @see #SeoDataCarItem
 */
 function formatQuantityItemsHBX(seoDataCartItems) {
 	var quantityItemsHBXStr = "";
 	for(var i in seoDataCartItems){
 		if (i > 0) quantityItemsHBXStr = quantityItemsHBXStr + ",";
 		var seoDataCartItem = seoDataCartItems[i];
 		quantityItemsHBXStr = quantityItemsHBXStr + seoDataCartItem.quantity;
 	}
 	return quantityItemsHBXStr;
 }
