<?php

namespace apexl\Io\modules\user\entities\operators;

use apexl\Io\operators\entityDatabaseOperator;

class twoFactorRecoveryCodeOperator extends entityDatabaseOperator
{
    public function __construct($table, $primaryKey = 'id')
    {
        parent::__construct($table, $primaryKey);
    }

    public function getAllForUser($userId)
    {
        return $this->vault
            ->select($this->dbTable)
            ->fields()
            ->where('user_id', $userId)
            ->where('used_at', NULL, 'IS NULL')
            ->execute()
            ->fetchAll();
    }

}
