<?php

namespace auctionforge\inc\model;

use auctionforge\inc\InstanceDB;

class History
{
    public function getNotSyncItems()
    {
        $db = InstanceDB::getInstanceDB();
        $sql = "SELECT SQL_CALC_FOUND_ROWS `id`, `lotId`, `auctionId`, `auctionSlug` FROM " . $db->prefix . "import_history WHERE `postId` IS NULL";
        $sql2 = "SELECT FOUND_ROWS()";
        $rows = $db->get_results($sql);
        $count = $db->get_var($sql2);

        return [
            'rows' => $rows,
            'total' => $count
        ];
    }

    public function getAuctionItems()
    {
        $db = InstanceDB::getInstanceDB();
        $sql = "SELECT SQL_CALC_FOUND_ROWS `id`, `lotId`, `auctionId`, `auctionSlug` FROM " . $db->prefix . "import_history WHERE `postId` IS NULL";
        $sql2 = "SELECT FOUND_ROWS()";
        $rows = $db->get_results($sql);
        $count = $db->get_var($sql2);

        return [
            'rows' => $rows,
            'total' => $count
        ];
    }
}
