<?php
/* This file has been auto-generated. Do not edit this file directly. */
namespace SabaiApps\Directories\Component\Notification\Model\Base;

use SabaiApps\Framework\Model\Model;
use SabaiApps\Framework\Criteria\AbstractCriteria;
use SabaiApps\Framework\DB\AbstractRowset;
use SabaiApps\Framework\Model\AbstractEntity;
use SabaiApps\Framework\Model\AbstractEntityRepository;

abstract class Notification extends AbstractEntity {

	public function __construct( Model $model ) {
		parent::__construct( 'Notification', $model );
		$this->_vars = array(
			'notification_event'   => null,
			'notification_system'  => 0,
			'notification_active'  => 0,
			'notification_data'    => null,
			'notification_id'      => 0,
			'notification_created' => 0,
			'notification_updated' => 0,
		);
	}

	public function __clone() {
		$this->_vars = array(
			'notification_id'      => 0,
			'notification_created' => 0,
			'notification_updated' => 0,
		) + $this->_vars;
	}

	public function __toString() {
		return 'Notification:' . $this->__get( 'id' );
	}

	public function __get( $name ) {
		if ( $name === 'event' ) {
			return $this->_vars['notification_event'];
		} elseif ( $name === 'system' ) {
			return $this->_vars['notification_system'];
		} elseif ( $name === 'active' ) {
			return $this->_vars['notification_active'];
		} elseif ( $name === 'data' ) {
			return $this->_vars['notification_data'];
		} elseif ( $name === 'id' ) {
			return $this->_vars['notification_id'];
		} elseif ( $name === 'created' ) {
			return $this->_vars['notification_created'];
		} elseif ( $name === 'updated' ) {
			return $this->_vars['notification_updated'];
		} else {
			return $this->fetchObject( $name );
		}
	}

	public function __set( $name, $value ) {
		if ( $name === 'event' ) {
			$this->_setVar( 'notification_event', $value );
		} elseif ( $name === 'system' ) {
			$this->_setVar( 'notification_system', $value );
		} elseif ( $name === 'active' ) {
			$this->_setVar( 'notification_active', $value );
		} elseif ( $name === 'data' ) {
			$this->_setVar( 'notification_data', $value );
		} elseif ( $name === 'id' ) {
			$this->_setVar( 'notification_id', $value );
		} else {
			$this->assignObject( $name, $value );
		}
	}

	protected function _initVar( $name, $value ) {
		if ( $name === 'notification_system' ) {
			$this->_vars['notification_system'] = (int) $value;
		} elseif ( $name === 'notification_active' ) {
			$this->_vars['notification_active'] = (int) $value;
		} elseif ( $name === 'notification_data' ) {
			$this->_vars['notification_data'] = @unserialize( $value );
		} elseif ( $name === 'notification_id' ) {
			$this->_vars['notification_id'] = (int) $value;
		} elseif ( $name === 'notification_created' ) {
			$this->_vars['notification_created'] = (int) $value;
		} elseif ( $name === 'notification_updated' ) {
			$this->_vars['notification_updated'] = (int) $value;
		} else {
			$this->_vars[ $name ] = $value;
		}
	}
}

abstract class NotificationRepository extends AbstractEntityRepository {

	public function __construct( Model $model ) {
		parent::__construct( 'Notification', $model );
	}

	protected function _getCollectionByRowset( AbstractRowset $rs ) {
		return new NotificationsByRowset( $rs, $this->_model->create( 'Notification' ), $this->_model );
	}

	public function createCollection( array $entities = array() ) {
		return new Notifications( $this->_model, $entities );
	}
}

class NotificationsByRowset extends \SabaiApps\Framework\Model\EntityCollection\RowsetEntityCollection {

	public function __construct( AbstractRowset $rs, Notification $emptyEntity, Model $model ) {
		parent::__construct( 'Notifications', $rs, $emptyEntity, $model );
	}
}

class Notifications extends \SabaiApps\Framework\Model\EntityCollection\ArrayEntityCollection {

	public function __construct( Model $model, array $entities = array() ) {
		parent::__construct( $model, 'Notifications', $entities );
	}
}
