<?xml version="1.0"?>

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

    <preference for="Eadesigndev\RomCity\Api\Data\RomCityInterface"
                type="Eadesigndev\RomCity\Model\RomCity"/>

    <preference for="Eadesigndev\RomCity\Api\RomCityRepositoryInterface"
                type="Eadesigndev\RomCity\Model\RomCityRepository" />

    <preference for="Eadesigndev\RomCity\Api\Data\CitySearchResultInterface"
                type="Magento\Framework\Api\SearchResults" />

    <preference for="Magento\Directory\Helper\Data"
                type="Eadesigndev\RomCity\Helper\CitiesJsonRomCity" />

    <type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory">
        <arguments>
            <argument name="collections" xsi:type="array">
                <item name="city_data_source" xsi:type="string">
                    Eadesigndev\RomCity\Model\ResourceModel\Collection\City\Grid\Collection
                </item>
            </argument>
        </arguments>
    </type>

    <type name="Eadesigndev\RomCity\Model\ResourceModel\Collection\City\Grid\Collection">
        <arguments>
            <argument name="mainTable" xsi:type="string">eadesign_romcity</argument>
            <argument name="eventPrefix" xsi:type="string">fields_grid_collection</argument>
            <argument name="eventObject" xsi:type="string">fields_grid_collection</argument>
            <argument name="resourceModel" xsi:type="string">Eadesigndev\RomCity\Model\ResourceModel\RomCity</argument>
        </arguments>
    </type>

    <type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory">
        <arguments>
            <argument name="collections" xsi:type="array">
                <item name="xtea_region_listing_data_source" xsi:type="string">
                    Eadesigndev\RomCity\Model\ResourceModel\Collection\Grid\Collection
                </item>
            </argument>
        </arguments>
    </type>

    <virtualType name="Eadesigndev\RomCity\Model\ResourceModel\Collection\Grid\Collection"
                 type="Magento\Framework\View\Element\UiComponent\DataProvider\SearchResult">
        <arguments>
            <argument name="mainTable" xsi:type="string">directory_country_region</argument>
            <argument name="resourceModel" xsi:type="string">Magento\Directory\Model\ResourceModel\Region</argument>
        </arguments>
    </virtualType>

    <virtualType name="FieldsGridDataProvider"
                 type="Magento\Framework\View\Element\UiComponent\DataProvider\DataProvider">
        <arguments>
            <argument name="collection" xsi:type="object" shared="false">
                Eadesigndev\RomCity\Model\ResourceModel\Collection\Grid\Collection
            </argument>
            <argument name="filterPool" xsi:type="object" shared="false">TemplatesGirdFilterPool</argument>
        </arguments>
    </virtualType>
</config>
