<?php
/********************************************************************************
 * (c)1337 aheadware.com - All rights reserved
 ********************************************************************************/

/**
 * Class TB_Shared_Ent_TeamData_Event
 *
 * @property int $id
 * @property string $ref_id
 * @property string $event_name
 * @property array|null $event_data
 * @property DateTime $trigger_dt
 * @property DateTime $last_update_dt
 * @property DateTime $created_dt
 */
class TB_Shared_Ent_TeamData_Event extends Francis_Db_Row
{
    public static function getEventsToTrigger()
    {
        $sql = 'SELECT * FROM ' . self::getTable() . ' WHERE trigger_dt < UTC_TIMESTAMP()';
        return self::findMany( $sql );
    }

    /**
     * Return table name
     *
     * @return null|string
     */
    public static function getTable()
    {
        return 'event';
    }

    /**
     * Return db handler
     *
     * @return Francis_Db_MySql|null
     */
    public static function getDbh()
    {
        return TB_Shared_Db_TeamData::get();
    }
}