<?php

/**
 * Helper class file for audit logging.
 *
 * THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 *
 * @package clearFusionCMS
 * @copyright Copyright (c) 2016 clearFusionCMS. All rights reserved.
 * @link http://clearfusioncms.com
 */

/**
 * cfCtntTypeAudit Class
 *
 * Static class to provide content type audit trail logging.
 *
 * @package clearFusionCMS
 */
abstract class cfCtntTypeAudit extends cfAudit {

	/**#@+
	 * Action codes.
	 */
	const CREATED = 2000;
	const UPDATED = 2010;
	const DELETED = 2020;
	/**#@-*/

	/**
	 * Record a content type create event.
	 *
	 * @param int $id The ID.
	 * @param string $name The name of the permission.
	 */
	static function created($id, $name) {
		self::record(self::CREATED, 'cfCtntType', $id, [
			'name' => $name
		]);
	}

	/**
	 * Record a content type update event.
	 *
	 * @param int $id The ID.
	 * @param string $name The name of the permission.
	 * @parma string $prev The previous name.
	 */
	static function update($id, $name, $prev) {
		self::record(self::UPDATED, 'cfCtntType', $id, [
			'name' => $name
		], $prev);
	}

	/**
	 * Record a content type delete event.
	 *
	 * @param int $id The ID.
	 * @param string $name The name of the permission.
	 * @parma string $prev The previous name.
	 */
	static function delete($id, $name, $prev) {
		self::record(self::DELETED, 'cfCtntType', $id, [
			'name' => $name
		], $prev);
	}
}
