<?php defined('SYSPATH') or die('No direct access allowed.');

/**
 * This class supports ADSL Plans
 *
 * @package    OSB
 * @subpackage ADSL
 * @category   Models
 * @author     Deon George
 * @copyright  (c) 2010 Open Source Billing
 * @license    http://dev.osbill.net/license.html
 */
class Model_ADSL_Supplier_Plan extends ORMOSB {
	// Relationships
	protected $_has_many = array(
		'adsl_plan'=>array('far_key'=>'id'),
	);
	protected $_belongs_to = array(
		'adsl_supplier'=>array('foreign_key'=>'supplier_id'),
	);

	/**
	 * Show the ADSL allowance as a peak/offpeak metric
	 */
	public function allowance() {
		return sprintf('%s/%s',$this->base_down_peak+$this->base_up_peak,$this->base_down_offpeak+$this->base_up_offpeak);
	}

	public function tax() {
		// @todo This should be taken from the users session
		// @todo rounding should be a system default
		return round($this->base_cost*.1,2);
	}

	public function name() {
		return $this->product_id;
	}
}
?>
