<?php

class Round extends Model
{

    // ===========
    // = Statics =
    // ===========

    protected static $table_name = 'MJ_ROUND';

    public static function getList()
    {
        $stm = parent::exec('ROUND_LIST');
        return $stm->fetchAll();
    }

    public static function getRow($id)
    {
        $stm = parent::exec('ROUND_GET_WITH_ID', ['id' => $id]);
        return $stm->fetchAll();
    }

    public static function getUsersInRound($id)
    {
        $stm = parent::exec('ROUND_GET_USERS', ['id' => $id]);
        return $stm->fetchAll();
    }

    public static function createRound($array)
    {
        $begin_date = date('Y-m-d H:i:s');
        $pimped_array = array_merge($array, ['begin_date'=>$begin_date]);

        $stm = parent::exec('ROUND_CREATE', $pimped_array);
    }

    public static function updateActions($array)
    {
        $stm = parent::exec('ACTION_UPDATE', $array);
    }
}