<?php

declare(strict_types=1);

namespace External\PompoBundle\SynchronizationRegister;

use External\PompoBundle\DataGo\Synchronizer\OrderSynchronizer;
use External\PompoBundle\Util\PompoUtil;
use KupShop\SynchronizationBundle\Synchronization\Job;
use KupShop\SynchronizationBundle\Synchronization\SynchronizationRegisterInterface;

class DataGoSynchronizationRegister implements SynchronizationRegisterInterface
{
    private PompoUtil $pompoUtil;

    public function __construct(PompoUtil $pompoUtil)
    {
        $this->pompoUtil = $pompoUtil;
    }

    public function getJobs(): iterable
    {
        yield Job::create('DataGo::orders', fn () => $this->pompoUtil->synchronizeDataGo([OrderSynchronizer::getType()]))
            ->everyMinute(5);
    }
}
