/**
* Gère les informations sur un produit à louer.
*
* @param Produit product   Produit à louer
* @param String  selection Sélection faite sur ce produit
* @param Integer quantity  Quantité choisie pour cette sélection
* @param Float   price     Prix de la sélection
* @access public
* @since 1.0
*/
function RentProduct(product, selection, quantity, price) {
	/**
	 * Produit à louer.
	 *
	 * @var Product
	 * @access private
	 * @since 1.0
	 */
	this.product = product;
	
	/**
	 * Sélection du produit.
	 *
	 * @var String
	 * @access private
	 * @since 1.0
	 */
	this.selection = selection;
	
	/**
	 * Quantité choisie pour la sélection.
	 *
	 * @var Integer
	 * @access private
	 * @since 1.0
	 */
	this.quantity = quantity;
	
	/**
	 * Prix de la sélection.
	 *
	 * @var Integer
	 * @access private
	 * @since 1.0
	 */
	this.price = price;
	
	/**
	* Modifie la sélection faite sur le produit.
	*
	* @param String value Sélection faite sur le produit
	* @access public
	* @since 1.0
	*/
	this.setSelection = function(value) {
		this.selection = value;
	}
	
	/**
	* Modifie la quantité choisie pour la sélection du produit.
	*
	* @param Integer value Quantité choisie pour la sélection du produit
	* @access public
	* @since 1.0
	*/
	this.setQuantity = function(value) {
		this.quantity = value;
	}
	
	/**
	* Modifie le prix de la sélection du produit.
	*
	* @param String value Durée de la location
	* @access public
	* @since 1.0
	*/
	this.setPrice = function(value) {
		prices = this.product.getPrice();
		price = 0.00;
		for(var i = 0; i < prices.length && price == 0.00; i++) {
			if(prices[i].duration == value) {
				price = prices[i].value;
			}
		}
		
		this.price = price;
	}
	
	/**
	* Renvoit le total de la location du produit.
	*
	* @return Float Montant de la location du produit
	* @access public
	* @since 1.0
	*/
	this.getTotal = function() {
		return (this.price * this.quantity);
	}
	
	/**
	* Renvoit les informations sur l'objet.
	*
	* @return String Information sur l'objet
	* @access public
	* @since 1.0
	*/
	this.toString = function() {
		string = '';
		
		string += 'product   = ' + "\n\t" + this.product + "\n";
		string += 'selection = ' + this.selection + "\n";
		string += 'quantity  = ' + this.quantity;
		string += 'price     = ' + this.price;
		
		return string;
	}
}
