<?php

namespace auctionforge\inc\controllers;

use stdClass;
use auctionforge\inc\abs\BidspiritWebhooks;
use auctionforge\inc\abs\Importer;
use auctionforge\inc\Debug;
use auctionforge\inc\helpers\SettingsHelper;
use auctionforge\inc\import\LotList;
use auctionforge\inc\model\Auction;
use auctionforge\inc\model\Lot;
use auctionforge\inc\traits\LoggerInfo;
use WP_Admin_Bar;
use WP_REST_Request;

class AdminBarTools
{
    use LoggerInfo;

    public function init()
    {
        add_action('admin_bar_menu', [$this, 'single_sync_button'], 80, 1);
    }

    /**
     * @param $wp_admin_bar WP_Admin_Bar
     * @return void
     */
    public function single_sync_button($wp_admin_bar)
    {
        global $post;
        $args = array(
            'id' => 'bp-single-sync',
            'title' => '<span class="ab-icon" aria-hidden="true"></span><span>Sync lot</span>',
            'href' => site_url('#sync')
        );

        if (is_single() && $post->post_type == BidspiritLots::POST_TYPE) {
            $wp_admin_bar->add_node($args);
        }
    }

}
$instance = new AdminBarTools();
$instance->init();
