<?php

use FiloBlu\Refilo\Remote\Entity\MagentoToRefiloProductAdapter;
use FiloBlu\Refilo\Remote\Entity\Product;
use Magento\Catalog\Api\ProductRepositoryInterface;
use Magento\Framework\App\Bootstrap;
use Magento\Framework\App\State;

require __DIR__ . '/../../../../../app/bootstrap.php';
$params = $_SERVER;
$bootstrap = Bootstrap::create(BP, $params);
$objectManager = $bootstrap->getObjectManager();
$state = $objectManager->get(State::class);
$state->setAreaCode('crontab');


/** @var ProductRepositoryInterface $productRepository */
$productRepository = $objectManager->get(ProductRepositoryInterface::class);
$product = $productRepository->get('config_obag', false, 1);

//$blackfire = new \Blackfire\Client();

//$helper = $objectManager->get(\FiloBlu\Refilo\Helper\Catalog\ProductAttributeHelper::class);

//$helper->getAttributes();

/** @var  MagentoToRefiloProductAdapter $adapter */
$adapter = $objectManager->create(MagentoToRefiloProductAdapter::class);


$productRefilo = new Product();
$result = $adapter->adapt($product, $productRefilo);

//
//$probe = $blackfire->createProbe();
$result = $adapter->adapt($product, $productRefilo);
//$blackfire->endProbe($probe);
//print_r($result);
