var ezizin = {};
ezizin.Restaurant = Class.create();
ezizin.ChoiceTypes = Class.create();
ezizin.ItemDetails = Class.create();
ezizin.ItemChoices = Class.create();
ezizin.OrderItem = Class.create();
ezizin.ShoppingCart = Class.create();
ezizin.UserPreference = Class.create();
ezizin.Address = Class.create();

ezizin.Restaurant.prototype = {

	initialize: function(id,name,sdesc,ldesc,dtime,lPriceforMeal,uPriceforMeal,mDeliveryAmt,open, close, addr1, addr2,addr, frating,prating,
		isOpen,foodRatingVotes,priceRatingVotes,cuisines,L_OpeningHours,L_ClosingHours,D_OpeningHours,D_ClosingHours,TimingFields,Status,Locality,activeMenu,RestaurantHomeDelivery,RestaurantDineIn,RestaurantAcceptCC,RestaurantServeAlcohol) {  
		this.id = id;
		this.name = name;
		this.shortDesc = sdesc;
		this.longDesc = ldesc;
		this.deliveryTime = dtime;
		this.lowerPriceForMeal = lPriceforMeal;
		this.upperPriceForMeal = uPriceforMeal;
		this.minimumDeliveryAmount = mDeliveryAmt;
		this.openHours = open;
		this.closeHours = close;
		this.address1 = addr1;
		this.address2 = addr2;
		this.address = addr;
		this.foodRating = frating;
		this.foodRatingVotes = foodRatingVotes;
		this.priceRating = prating;
		this.priceRatingVotes = priceRatingVotes;
		this.cuisines = cuisines;
		this.isOpen = isOpen;
		this.L_OpeningHours = L_OpeningHours;
		this.L_ClosingHours = L_ClosingHours;
		this.D_OpeningHours = D_OpeningHours;
		this.D_ClosingHours = D_ClosingHours;
		this.timingfields = TimingFields;
		this.status = Status;
		this.locality = Locality;
		this.activemenu = activeMenu;
		this.homedelivery = RestaurantHomeDelivery;
		this.dinein = RestaurantDineIn;
		this.acceptcc = RestaurantAcceptCC;
		this.servealcohol  = RestaurantServeAlcohol;
	}
}


ezizin.ChoiceTypes.prototype = {

	initialize: function(itemId, choiceTypeId, restaurantId, choiceTypeName, parentChoiceTypeId, maxSelection, triggerOnSelecting, isMandatory,
		hasChild, priceToBeAdded, parentChoiceTypeValue) {
		
		this.itemId = itemId;
		this.choiceTypeId = choiceTypeId;
		this.restaurantId = restaurantId;
		this.choiceTypeName = choiceTypeName;
		this.parentChoiceTypeId = parentChoiceTypeId;
		this.maxSelection = maxSelection;
		this.triggerOnSelecting = triggerOnSelecting;
		this.isMandatory = isMandatory;
		this.hasChild = hasChild;
		this.priceToBeAdded = priceToBeAdded;
		this.parentChoiceTypeValue = parentChoiceTypeValue;
		this.itemChoices = new Array();
		this.itemChoicesAssoc = new Array();
	}
}


ezizin.ItemDetails.prototype = {

	initialize: function(itemId, menuId, itemName, itemPrice, isVegetarian, itemDescription, numberOfTimesOrdered, promotionApplicable) {

		this.itemId = itemId;
		this.menuId = menuId;
		this.itemName = itemName;
		this.itemPrice = itemPrice;
		this.isVegetarian = isVegetarian;

		this.itemDescription = itemDescription;
		this.numberOfTimesOrdered = numberOfTimesOrdered;
		this.promotionApplicable = promotionApplicable;
	}
}


ezizin.ItemChoices.prototype = {

	initialize: function(choiceId, itemId, choiceName, choicePrice, choiceValue) {

		this.choiceId = choiceId;
		this.itemId = itemId;
		this.choiceName = choiceName;
		this.choicePrice = choicePrice;
		this.choiceValue = choiceValue;
	}
}

ezizin.OrderItem.prototype = {

	initialize: function(itemId,orderItemId, quantity, price, totalPrice, itemDetails,choices) {

		this.itemId = itemId;
		this.orderItemId = orderItemId;
		this.quantity = quantity;
		this.price = price;
		this.totalPrice = totalPrice;
		this.itemDetails = itemDetails;
		this.choices = choices;
	}
}

ezizin.ShoppingCart.prototype = {

	initialize: function() {

		this.orderItems = new Array();
		this.orderItemsAssoc = new Array();
		this.subTotal = 0.0;
		this.itemCount = 0;
		this.tax = 0.0;
		this.grandTotal = 0.0;
	},
	
	addItem: function( orderItem ){
		this.orderItems[this.orderItems.length] = orderItem;
		this.orderItemsAssoc[orderItem.OrderItemId] = orderItem;
		this.subTotal += parseFloat(orderItem.totalPrice);
		this.itemCount++;
		this.tax = (this.subTotal) * 12 / 100;
		this.grandTotal = parseFloat(this.subTotal) + this.tax;
	}
}

ezizin.UserPreference.prototype = {

	initialize: function(userLoggedIn, userId,localityId,localityText,cityId,cityText,order_date,order_time, cusine) {
		this.userLoggedIn = userLoggedIn;
		this.userId = userId;
		this.localityId = localityId;
		this.localityText = localityText;
		this.cityId = cityId;
		this.cityText = cityText;
		this.order_date = order_date;
		this.order_time = order_time;
		this.cusine = cusine;
	}
}

ezizin.Address.prototype = {

	initialize: function(AddressId,AddressName,Address1, Address2,AddressLocality,AddressLocalityName, AddressState,AddressStateName,AddressZip, PreferredAddress, MajorLandmark, AddressStatus ) {
		this.AddressId = AddressId;
		this.AddressName = AddressName;
		this.Address1 = Address1;
		this.Address2 = Address2;
		this.AddressLocality = AddressLocality;
		this.AddressLocalityName = AddressLocalityName;
		this.AddressState = AddressState;
		this.AddressStateName = AddressStateName;
		this.AddressZip = AddressZip;		
		this.PreferredAddress = PreferredAddress;
		this.MajorLandmark = MajorLandmark;
		this.AddressStatus = AddressStatus;
	}
}
