<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <!-- monitored jobs are added to Autogedal\FeedMonitor\Model\JobRegistry (argument "jobs") by the modules that
         own them, see Leadlion_StockUpdates / Leadlion_Autogedal etc/di.xml -->

    <!-- Firebear import jobs (active, scheduled) are monitored as firebear_job_<id> -->
    <type name="Autogedal\FeedMonitor\Model\JobRegistry">
        <arguments>
            <argument name="providers" xsi:type="array">
                <item name="firebear" xsi:type="object">Autogedal\FeedMonitor\Model\Firebear\FirebearJobs</item>
            </argument>
        </arguments>
    </type>

    <!-- result of every Firebear import run by cron / CLI / API (admin "Run" skips the handlers: not monitored) -->
    <type name="Firebear\ImportExport\Model\Job\Handler\SummaryHandler">
        <plugin name="autogedal_feed_monitor_record_import" type="Autogedal\FeedMonitor\Plugin\Firebear\RecordImportResult"/>
    </type>

    <!-- source adapters checked periodically -->
    <type name="Autogedal\FeedMonitor\Model\Checker">
        <arguments>
            <argument name="sources" xsi:type="array">
                <item name="custom_cron" xsi:type="object">Autogedal\FeedMonitor\Model\Adapter\CustomCronMonitor</item>
                <item name="custom_subfeed" xsi:type="object">Autogedal\FeedMonitor\Model\Adapter\CustomSubfeedMonitor</item>
                <item name="firebear" xsi:type="object">Autogedal\FeedMonitor\Model\Adapter\FirebearJobMonitor</item>
                <item name="magento_heartbeat" xsi:type="object">Autogedal\FeedMonitor\Model\Adapter\MagentoHeartbeatMonitor</item>
            </argument>
        </arguments>
    </type>

    <!-- built when the command runs, not at bin/magento start: the test options of the run command replace the
         HttpClient before the feed reader exists -->
    <type name="Autogedal\FeedMonitor\Console\Command\CheckCommand">
        <arguments>
            <argument name="checker" xsi:type="object">Autogedal\FeedMonitor\Model\Checker\Proxy</argument>
        </arguments>
    </type>

    <type name="Magento\Framework\Console\CommandListInterface">
        <arguments>
            <argument name="commands" xsi:type="array">
                <item name="autogedal_feed_monitor_check" xsi:type="object">Autogedal\FeedMonitor\Console\Command\CheckCommand</item>
                <item name="autogedal_feed_monitor_status" xsi:type="object">Autogedal\FeedMonitor\Console\Command\StatusCommand</item>
                <item name="autogedal_feed_monitor_allow_incomplete" xsi:type="object">Autogedal\FeedMonitor\Console\Command\AllowIncompleteCommand</item>
                <item name="autogedal_feed_monitor_test_email" xsi:type="object">Autogedal\FeedMonitor\Console\Command\TestEmailCommand</item>
                <item name="autogedal_feed_monitor_run" xsi:type="object">Autogedal\FeedMonitor\Console\Command\RunJobCommand</item>
            </argument>
        </arguments>
    </type>
</config>
