<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">

    <!-- Grid collection for autogedal_label admin listing (global so it merges correctly with other modules) -->
    <virtualType name="Autogedal\Labels\Model\ResourceModel\Label\Grid\Collection"
                 type="Magento\Framework\View\Element\UiComponent\DataProvider\SearchResult">
        <arguments>
            <argument name="mainTable" xsi:type="string">autogedal_label</argument>
            <argument name="resourceModel" xsi:type="string">Autogedal\Labels\Model\ResourceModel\Label</argument>
        </arguments>
    </virtualType>

    <!-- Map UI data source handles to grid collection -->
    <type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory">
        <arguments>
            <argument name="collections" xsi:type="array">
                <item name="autogedal_label_listing_data_source"
                      xsi:type="string">Autogedal\Labels\Model\ResourceModel\Label\Grid\Collection</item>
                <item name="autogedal_label_form_data_source"
                      xsi:type="string">Autogedal\Labels\Model\ResourceModel\Label\Grid\Collection</item>
            </argument>
        </arguments>
    </type>

    <type name="Magento\Catalog\Model\Config">
        <plugin name="autogedal_labels_catalog_config_product_attributes"
                type="Autogedal\Labels\Plugin\Catalog\Model\ConfigPlugin"
                sortOrder="10"/>
    </type>

</config>
