<?php

/**
 * Stock API.
 * For Hub accounts only used for stock management and orders.
 *
 * @package northmill-online-shared
 */
declare (strict_types=1);
namespace Northmill_Online_Shared_Sync\Northmill_Online_Shared\Abstracts\Hub_API;

use Northmill_Online_Shared_Sync\Northmill_Online_Shared\Abstract_Shared_Base;
use Northmill_Online_Shared_Sync\Northmill_Online_Shared\Abstracts\Hub_API\Hub_Accounts\Models\Hub_Account_Model;
use Northmill_Online_Shared_Sync\Northmill_Online_Shared\Modules\Loggers\Log_Level_Enum;
defined('ABSPATH') || exit;
/**
 * Stock API.
 */
class Stock_API extends API
{
    /**
     * Construct stock API.
     *
     * @param Hub_Account_Model $account Account to connect to API.
     */
    public function __construct(Hub_Account_Model $account)
    {
        if (!$account->is_stock()) {
            Abstract_Shared_Base::base_instance()->logger->log('sync', 'Trying to load stock API with non-stock account', array('account_basics' => $account->get_account_basics_for_logging()), Log_Level_Enum::ERROR);
            return;
        }
        parent::__construct($account);
    }
}
