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

/**
 * This class supports Service Plugins.
 *
 * @package    OSB
 * @subpackage Product/Service
 * @category   Models
 * @author     Deon George
 * @copyright  (c) 2010 Open Source Billing
 * @license    http://dev.osbill.net/license.html
 */
abstract class Model_Service_Plugin extends ORMOSB {
	// Reset any sorting that may be defined in our parent
	protected $_sorting = array();

	/**
	 * Form info for admins to update
	 */
	abstract public function admin_update();

	/**
	 * Our service name as defined in the DB
	 */
	abstract public function name();

	/**
	 * Show our service name as defined in the DB with product suffix.
	 */
	public function service_name() {
		return sprintf('%s - %s',$this->service->product->name(),$this->name());
	}

	/**
	 * View details of the service
	 */
	abstract public function service_view();

	/**
	 * Get specific service details for use in other modules
	 * For Example: Invoice
	 *
	 * @todo Make the rendered items configurable
	 * @todo Change this method name, now that it is public
	 */
	public function _details($type) {
		switch ($type) {
			// Nothing to add for invoices
			case 'invoice_detail_items':
				return array();

			default:
				throw new Kohana_Exception('Unkown detail request :type',array(':type'=>$type));
		}
	}
}
?>
