#
# Module services
#
# Copyright (c) 2011-present Qualiteam software Ltd. All rights reserved.
# See https://www.x-cart.com/license-agreement.html for license details.

parameters:
  auto_trial.default_limit: 100

  auto_trial.end_date: "%env(default::string:XCART_END_DATE)%"

  auto_trial.products_limit: "%env(default:auto_trial.default_limit:int:AUTOTRIAL_PRODUCTS_LIMIT)%"

  autoimport.background.enabled.default: 0
  autoimport.background.enabled: "%env(default:autoimport.background.enabled.default:bool:FORCE_AUTOIMPORT_BACKGROUND_JOBS_ENABLED)%"

  autoimport.test.api.gateway.default: 0
  autoimport.test.api.gateway: "%env(default:autoimport.test.api.gateway.default:bool:AUTOIMPORT_TEST_API_GATEWAY_ENABLED)%"

  autoimport.metadata_products_search.enabled.default: 0
  autoimport.metadata_products_search.enabled: "%env(default:autoimport.metadata_products_search.enabled.default:bool:AUTOIMPORT_METADATA_PRODUCTS_SEARCH_ENABLED)%"

  autoimport.background.process.import.vehicles.option.name: 'AutoRunImportVehicles'
  autoimport.background.process.re.assign.stock.option.name: 'AutoReassignStock'

monolog:
  channels:
    - auto_import_commands
  handlers:
    auto_import_commands:
      level: debug # Log all
      type: service
      id: xc.autoimportbase.logs_handler
      channels: ["auto_import_commands"]

services:
  _defaults:
    autowire: true

  xc.autoimportbase.logs_formatter:
    class: Monolog\Formatter\LineFormatter
    arguments:
      $format: "[%%datetime%%] %%message%% %%context%%\n"

  xc.autoimportbase.logs_handler:
    class: XCart\Monolog\Handler\XCFileHandler
    calls:
      - [setFormatter, ['@xc.autoimportbase.logs_formatter']]
    arguments:
      $path: '%kernel.logs_dir%'
      $file: 'auto_import'
      $skipDeprecation: '%env(bool:LOGGER_SKIP_DEPRECATIONS)%'
      $level: '100'       # Log all

  XC\AutoImportBase\Console\Command\ActualizeWorkersState:
    tags: ['console.command']
    arguments:
      $daemons: !tagged_iterator {tag: 'xcart.auto.daemons_hook'}

  XC\AutoImportBase\Core\Manager\SystemdServicesManager:
    class: XC\AutoImportBase\Core\Manager\SystemdServicesManager
    public: true
    arguments:
      $logger: '@xc.auto_import_base.logger'

  XC\AutoImportBase\Messenger\Transport\Sender\SendersLocator:
    decorates: messenger.senders_locator
    arguments:
      - '@XCart\Messenger\Transport\Sender\SendersLocator.inner'
      - '@.inner'
      - '%autoimport.background.enabled%'

  XC\AutoImportBase\Core\Cache\CacheFactory: ~
  XC\AutoImportBase\Core\Cache\Cache:
    class: XC\AutoImportBase\Core\Cache\Cache
    factory: ['@XC\AutoImportBase\Core\Cache\CacheFactory', 'createCache']

  XC\AutoImportBase\Core\Data\Helper\ImportProductHelper:
    public: true
    class: XC\AutoImportBase\Core\Data\Helper\ImportProductHelper
    arguments:
      $importProductRepo: '@xc.autoimportbase.repository.import_product'

  xc.autoimportbase.repository.import_product:
    class: XC\AutoImportBase\Model\Repo\ImportProduct
    factory: ['@doctrine.orm.default_entity_manager', getRepository]
    public: true
    arguments:
      - XC\AutoImportBase\Model\ImportProduct

  xc.autoimportbase.repository.attribute:
    class: XLite\Model\Repo\Attribute
    factory: ['@doctrine.orm.default_entity_manager', getRepository]
    public: true
    arguments:
      - XLite\Model\Attribute

  xc.autoimportbase.repository.tmpvar:
    class: XLite\Model\Repo\TmpVar
    factory: ['@doctrine.orm.default_entity_manager', getRepository]
    public: true
    arguments:
      - XLite\Model\TmpVar

  autoimport.repository.clean_urls:
    class: XLite\Model\Repo\CleanURL
    factory: ['@doctrine.orm.default_entity_manager', getRepository]
    public: true
    arguments:
      - XLite\Model\CleanURL

  autoimport.repository.category_products:
    class: XLite\Model\Repo\CategoryProducts
    factory: ['@doctrine.orm.default_entity_manager', getRepository]
    public: true
    arguments:
      - XLite\Model\CategoryProducts

  autoimport.repository.category_images:
    class: XLite\Model\Repo\Image\Category\Image
    factory: ['@doctrine.orm.default_entity_manager', getRepository]
    public: true
    arguments:
      - XLite\Model\Image\Category\Image

  autoimport.repository.product_images:
    class: XLite\Model\Repo\Image\Product\Image
    factory: ['@doctrine.orm.default_entity_manager', getRepository]
    public: true
    arguments:
      - XLite\Model\Image\Product\Image

  autoimport.repository.language:
    class: XLite\Model\Repo\Language
    factory: ['@doctrine.orm.default_entity_manager', getRepository]
    public: true
    arguments:
      - XLite\Model\Language

  autoimport.repository.product:
    alias: xcart.repository.product
    public: true

  xc.autoimportbase.repository.schedule_settings:
    class: XC\AutoImportBase\Model\Repo\ScheduleSetting
    factory: ['@doctrine.orm.default_entity_manager', getRepository]
    public: true
    arguments:
      - XC\AutoImportBase\Model\ScheduleSetting

  xc.autoimportbase.repository.schedule_setting_option:
    class: XC\AutoImportBase\Model\Repo\ScheduleSettingOption
    factory: ['@doctrine.orm.default_entity_manager', getRepository]
    public: true
    arguments:
      - XC\AutoImportBase\Model\ScheduleSettingOption

  qsl.shopbybrand.repository.brand:
    class: QSL\ShopByBrand\Model\Repo\Brand
    factory: ['@doctrine.orm.default_entity_manager', getRepository]
    public: true
    arguments:
      - QSL\ShopByBrand\Model\Brand

  xc.autoimportbase.repository.sub_block_import_status:
    class: XC\AutoImportBase\Model\Repo\ARepo
    factory: ['@doctrine.orm.default_entity_manager', getRepository]
    public: true
    arguments:
      - XC\AutoImportBase\Model\SubBlockImportStatus

  xc.autoimportbase.repository.currency:
    class: XLite\Model\Repo\Currency
    factory: ['@doctrine.orm.default_entity_manager', getRepository]
    public: true
    arguments:
      - XLite\Model\Currency

  XC\AutoImportBase\Core\Data\Factory\RepositoriesFactory:
    class: XC\AutoImportBase\Core\Data\Factory\RepositoriesFactoryWithDefaultRepos

  xc.autoimportbase.repository.resource.queue.entity:
    class: XC\AutoImportBase\Model\Repo\ResourceQueueEntity
    public: true
    factory: ['@doctrine.orm.default_entity_manager', getRepository]
    arguments:
      - XC\AutoImportBase\Model\ResourceQueueEntity

  autoimport.brand.data.helper:
    public: true
    alias: XC\AutoImportBase\Core\Data\Helper\ShopByBrandBrandHelper

  XC\AutoImportBase\Core\Data\Helper\ShopByBrandBrandHelper:
    public: true
    class: XC\AutoImportBase\Core\Data\Helper\ShopByBrandBrandHelper
    arguments:
      $cleanUrlRepo: '@autoimport.repository.clean_urls'
      $storageHelper: '@autoimport.brand.storage.helper'

  autoimport.brand.storage.helper:
    class: XC\AutoImportBase\Core\Data\Helper\StorageHelper
    arguments:
      $copyImage: false

  autoimport.product.storage.helper:
    class: XC\AutoImportBase\Core\Data\Helper\StorageHelper
    arguments:
      $copyImage: false

  XC\AutoImportBase\Core\Data\Helper\KnownEntityHelper: ~
  XC\AutoImportBase\Core\Data\Factory\HelpersWithProductFactory:
    class: XC\AutoImportBase\Core\Data\Factory\HelpersWithProductFactory
    arguments:
      $knownEntityHelper: '@XC\AutoImportBase\Core\Data\Helper\KnownEntityHelper'
      $shopByBrandHelper: '@XC\AutoImportBase\Core\Helper\ShopByBrandHelper'
      $makeAdapter: '@XC\AutoImportBase\Core\Data\Helper\MakeAdapter'
      $makeLevelsHelper: '@XC\AutoImportBase\Core\Data\Helper\MakeLevelsHelper'
      $storageHelper: '@autoimport.product.storage.helper'
      $categoryPathHelper: '@XC\AutoImportBase\Core\Data\Helper\CategoryPathHelper'

  XC\AutoImportBase\Core\Helper\ShopByBrandHelper:
    public: true # @see \XC\AutoImportBase\Core\Traits\BrandsTrait
    arguments:
      $attributeRepo: '@xc.autoimportbase.repository.attribute'

  XC\AutoImportBase\Core\Gateway\ICommandsGateway:
    class: XC\AutoImportBase\Core\Gateway\CommandsGateway
    public: true
    arguments:
      $bus: '@messenger.default_bus'

  XC\AutoImportBase\Core\Resource\IResourceQueueGateway:
    class: XC\AutoImportBase\Core\Resource\ResourceQueueGateway
    public: true
    arguments:
      $resourceQueueRepo: '@xc.autoimportbase.repository.resource.queue.entity'
      $logger: '@xc.auto_import_base.logger'

  XC\AutoImportBase\Core\ShouldStopImportListener:
    tags:
      - {name: kernel.event_listener, event: auto_import.product.update.after, method: onAfterProductUpdate}
      - {name: kernel.event_listener, event: auto_import.products.batch.finished, method: onProductsBatchFinished}
      - {name: kernel.event_listener, event: auto_import.pull.brand.data.started, method: onPullBrandDataStarted}
      - {name: kernel.event_listener, event: auto_import.pull.brand.data.completed, method: onPullBrandDataCompleted}
      - {name: kernel.event_listener, event: auto_import.pull.vehicles.block.finished, method: onImportVehiclesCancel}
      - {name: kernel.event_listener, event: auto_import.pull.vehicles.completed, method: onImportVehiclesCancel}
      - {name: kernel.event_listener, event: auto_import.pull.vehicles.started, method: onImportVehiclesCancel}
      - {name: kernel.event_listener, event: auto_import.vehicle.update.after, method: onImportVehiclesCancel}
      - {name: kernel.event_listener, event: auto_import.supplier.re.assign.started, method: cancelSupplierReAssign}
      - {name: kernel.event_listener, event: auto_import.supplier.re.assign.product.updated, method: cancelSupplierReAssign}
      - {name: kernel.event_listener, event: auto_import.supplier.re.assign.batch.finished, method: cancelSupplierReAssign}

  XC\AutoImportBase\Core\Data\Converter\DimConverter:
    class: XC\AutoImportBase\Core\Data\Converter\DimConverter
    arguments:
      $configRepo: '@xcart.repository.config'
      $configUnitName: 'dim_unit'

  XC\AutoImportBase\Core\Data\Converter\WeightConverter:
    class: XC\AutoImportBase\Core\Data\Converter\WeightConverter
    arguments:
      $configRepo: '@xcart.repository.config'
      $configUnitName: 'weight_unit'

  XC\AutoImportBase\Core\EventListener\RePropagateAllConstraintListener:
    tags:
      - {name: kernel.event_listener, event: auto_import.block.import.constraints.failed, method: onConstraintFailed}

  XC\AutoImportBase\Core\EventListener\PullLocationListener:
    arguments:
      $pullLocationServices: !tagged_iterator {tag: 'xc.autoimportbase.pull_locations'}
    tags:
      - {name: kernel.event_listener, event: auto_import.brands.completed, method: pullLocations}
      - {name: kernel.event_listener, event: auto_import.pull.brand.data.completed, method: pullLocations}

  XC\AutoImportBase\Core\EventListener\CategoriesStructureListener:
    arguments:
      $logger: '@xc.auto_import_base.logger'
    tags:
      - {name: kernel.event_listener, event: auto_import.pull.brand.data.completed, method: onImportCompleted}
      - {name: kernel.event_listener, event: auto_import.pull.brand.data.failed, method: onImportFailed}
      - {name: kernel.event_listener, event: auto_import.pull.brand.data.cancelled, method: onImportCancelled}

  XC\AutoImportBase\Core\EventListener\StopWorkerIfEntityManagerIsOpenListener:
    tags:
      - {name: kernel.event_listener, event: Symfony\Component\Messenger\Event\WorkerRunningEvent, method: onWorkerRunning}

  XC\AutoImportBase\Core\EventListener\ImportStatusListener:
    tags:
      - {name: kernel.event_listener, event: auto_import.pull.brand.data.started, method: onImportStarted, priority: -100}
      - {name: kernel.event_listener, event: auto_import.pull.brand.data.completed, method: onImportCompleted, priority: -100}
      - {name: kernel.event_listener, event: auto_import.pull.brand.data.failed, method: onImportFailed, priority: -100}

  XC\AutoImportBase\Core\EventListener\ImportWorkerPingListener:
    tags:
      - {name: kernel.event_listener, event: auto_import.brands.batch.finished, method: onBatchFinishedEvent}
      - {name: kernel.event_listener, event: auto_import.products.batch.finished, method: onBatchFinishedEvent}
      - {name: kernel.event_listener, event: auto_import.pull.vehicles.block.finished, method: onBatchFinishedEvent}

  XC\AutoImportBase\Core\EventListener\ImportCloudSearchListener:
    tags:
      - {name: kernel.event_listener, event: Symfony\Component\Messenger\Event\WorkerRunningEvent, method: onWorkerRunning}
      - {name: kernel.event_listener, event: auto_import.pull.brand.data.started, method: onImportStarted}
      - {name: kernel.event_listener, event: auto_import.pull.brand.data.completed, method: onImportCompleted}
      - {name: kernel.event_listener, event: auto_import.pull.brand.data.failed, method: onImportFailed}

  XC\AutoImportBase\Core\EventListener\ImportProcessIdListener:
    tags:
      - {name: kernel.event_listener, event: auto_import.pull.brand.data.started, method: onImportStarted, , priority: 100}
      - {name: kernel.event_listener, event: auto_import.pull.brand.data.completed, method: onImportCompleted, , priority: 100}
      - {name: kernel.event_listener, event: auto_import.pull.brand.data.failed, method: onImportFailed, , priority: 100}

  XC\AutoImportBase\Core\EventListener\ImportProductsChangesListener:
    tags:
      - {name: kernel.event_listener, event: auto_import.pull.brand.data.started, method: onImportStarted}

  XC\AutoImportBase\Core\EventListener\ImportStatusHistoryListener:
    tags:
      - {name: kernel.event_listener, event: auto_import.import.status.changed, method: onImportStatusChanged}

  XC\AutoImportBase\Core\EventListener\ImportLogsListener:
    arguments:
      $logger: '@xc.auto_import_base.logger'
    tags:
      - {name: kernel.event_listener, event: auto_import.pull.brand.data.started, method: onImportStarted}
      - {name: kernel.event_listener, event: auto_import.product.update.before, method: onBeforeProductUpdate}
      - {name: kernel.event_listener, event: auto_import.product.update.after, method: onAfterProductUpdate}
      - {name: kernel.event_listener, event: auto_import.products.batch.finished, method: onProductsBatchFinished}
      - {name: kernel.event_listener, event: auto_import.pull.brand.data.completed, method: onImportCompleted}
      - {name: kernel.event_listener, event: auto_import.pull.brand.data.failed, method: onImportFailed}

  XC\AutoImportBase\Core\EventListener\BrandsImportLogsListener:
    tags:
      - {name: kernel.event_listener, event: auto_import.brands.started, method: onImportStarted}
      - {name: kernel.event_listener, event: auto_import.brands.batch.finished, method: onImportBatchFinished}
      - {name: kernel.event_listener, event: auto_import.brands.constraint_failed, method: onImportConstraintFailed}
      - {name: kernel.event_listener, event: auto_import.brands.completed, method: onImportCompleted}
      - {name: kernel.event_listener, event: auto_import.brands.failed, method: onImportFailed}

  XC\AutoImportBase\Core\EventListener\BrandsImportAvailabilityListener:
    tags:
      - {name: kernel.event_listener, event: auto_import.brands.started, method: onImportStarted}
      - {name: kernel.event_listener, event: auto_import.brands.completed, method: onImportCompleted}

  XC\AutoImportBase\Core\EventListener\BrandsImportStatusListener:
    tags:
      - {name: kernel.event_listener, event: auto_import.brands.started, method: onImportStarted}
      - {name: kernel.event_listener, event: auto_import.brands.completed, method: onImportCompleted}
      - {name: kernel.event_listener, event: auto_import.brands.failed, method: onImportFailed}

  XC\AutoImportBase\Core\EventListener\Notifications\AdminBrandsImportNotificationsListener:
    tags:
      - {name: kernel.event_listener, event: auto_import.brands.completed, method: onImportCompleted}
      - {name: kernel.event_listener, event: auto_import.brands.constraint_failed, method: onImportConstraintFailed}
      - {name: kernel.event_listener, event: auto_import.brands.failed, method: onImportFailed}

  xc.auto_import_base.constraints_notifications_listener:
    class: XC\AutoImportBase\Core\EventListener\Notifications\AdminConstraintsFailedNotificationsListener
    tags:
      - {name: kernel.event_listener, event: auto_import.block.import.constraints.failed, method: onConstraintFailed}

  xc.auto_import_base.import_status_notification_listener:
    class: XC\AutoImportBase\Core\EventListener\Notifications\AdminImportNotificationsListener
    tags:
      - {name: kernel.event_listener, event: auto_import.pull.brand.data.started, method: onImportStarted, priority: -100}
      - {name: kernel.event_listener, event: auto_import.pull.brand.data.completed, method: onImportCompleted, priority: -100}
      - {name: kernel.event_listener, event: auto_import.pull.brand.data.failed, method: onImportFailed, priority: -100}

  XC\AutoImportBase\Core\Command\BlockImport\DefaultDecoratedBlockImportFactory: ~

  XC\AutoImportBase\Core\EventListener\ImportStatusChangedLogsListener:
    arguments:
      $logger: '@xc.auto_import_base.logger'
    tags:
      - {name: kernel.event_listener, event: auto_import.import.status.changed, method: onImportStatusChanged}
      - {name: kernel.event_listener, event: auto_import.sub.block.import.status.changed, method: onSubBlockStatusChanged}

  XC\AutoImportBase\Core\EventListener\AutoRunImportVehiclesListener:
    arguments:
      $eventManager: '@xc.auto_import_base.importVehicleEventStateManager'
    tags:
      - {name: kernel.event_listener, event: auto_import.pull.vehicles.block.finished, method: onImportBlockFinished}
      - {name: kernel.event_listener, event: auto_import.pull.vehicles.completed, method: onImportCompleted}
      - {name: kernel.event_listener, event: auto_import.pull.vehicles.failed, method: onImportFailed}
      - {name: kernel.event_listener, event: auto_import.pull.vehicles.cancelled, method: onImportCancelled}
      - {name: kernel.event_listener, event: auto_import.vehicle.update.after, method: onVehicleUpdated}
      - {name: kernel.event_listener, event: auto_import.pull.vehicles.blocks.got, method: onImportBlocksGot}

  XC\AutoImportBase\Core\EventListener\BrandConstraintsFailedListener:
    tags:
      - {name: kernel.event_listener, event: auto_import.block.import.constraints.failed, method: onConstraintFailed}

  XC\AutoImportBase\Core\EventListener\NewStoragesFilter: ~

  xc.auto_import_base.realtime_import_images:
    class: XC\AutoImportBase\Core\EventListener\RealtimeImportImages
    tags:
      - {name: kernel.event_listener, event: auto_import.product.update.before, method: onBeforeProductUpdate}
      - {name: kernel.event_listener, event: auto_import.product.update.after, method: onAfterProductUpdate}
      - {name: kernel.event_listener, event: auto_import.products.batch.finished, method: onProductsBatchFinished}

  xc.auto_import_base.realtime_import_vehicle_images:
    class: XC\AutoImportBase\Core\EventListener\RealtimeImportVehicleImages
    tags:
      - {name: kernel.event_listener, event: auto_import.vehicle.update.before, method: onBeforeVehicleUpdate}
      - {name: kernel.event_listener, event: auto_import.vehicle.update.after, method: onAfterVehicleUpdate}
      - {name: kernel.event_listener, event: auto_import.pull.vehicles.block.finished, method: onVehicleBatchFinished}

  xc.auto_import_base.stock_and_price:
    class: XC\AutoImportBase\Core\EventListener\StockAndPriceListener
    tags:
      - {name: kernel.event_listener, event: auto_import.product.update.after, method: onAfterProductUpdate}
      - {name: kernel.event_listener, event: auto_import.products.batch.finished, method: onProductsBatchFinished}

  xc.auto_import_base.realtime_import_brand_images:
    class: XC\AutoImportBase\Core\EventListener\RealtimeImportBrandImages
    tags:
      - {name: kernel.event_listener, event: auto_import.brand.update.before, method: onBeforeBrandUpdate}
      - {name: kernel.event_listener, event: auto_import.brand.update.after, method: onAfterBrandUpdate}

  xc.auto_import_base.realtime_import_attachments:
    class: XC\AutoImportBase\Core\EventListener\RealtimeImportAttachments
    tags:
      - {name: kernel.event_listener, event: auto_import.product.update.before, method: onBeforeProductUpdate}
      - {name: kernel.event_listener, event: auto_import.product.update.after, method: onAfterProductUpdate}
      - {name: kernel.event_listener, event: auto_import.products.batch.finished, method: onProductsBatchFinished}

  XC\AutoImportBase\Core\EventListener\QuickDataListener:
    arguments:
      $logger: '@xc.auto_import_base.logger'
    tags:
      - {name: kernel.event_listener, event: auto_import.product.update.after, method: onAfterProductUpdate}
      - {name: kernel.event_listener, event: auto_import.pull.brand.data.completed, method: onImportFinished}
      - {name: kernel.event_listener, event: auto_import.pull.brand.data.failed, method: onImportFinished}

  XC\AutoImportBase\Core\EventListener\BrandImportDiscontinuedProductsListener:
    arguments:
      $logger: '@xc.auto_import_base.logger'
      $batchSize: 100
    tags:
      - {name: kernel.event_listener, event: auto_import.pull.brand.data.started, method: onImportStarted}
      - {name: kernel.event_listener, event: auto_import.product.received, method: onProductReceived}
      - {name: kernel.event_listener, event: auto_import.pull.brand.data.completed, method: onImportCompleted}

  xc.auto_import_base.logger:
    class: Psr\Log\LoggerInterface
    public: true
    factory: ['@XLite\Logger', getLogger]
    arguments:
      - 'XC-AutoImportBase'

  XC\AutoImportBase\Core\Data\DTO\TireSizesParser: ~

  XC\AutoImportBase\Core\Data\Helper\LastLevelsCollectionHelper:
    class: XC\AutoImportBase\Core\Data\Helper\LastLevelsCollectionHelper
    public: true

  XC\AutoImportBase\Core\Data\Helper\MakeAdapter: ~
  XC\AutoImportBase\Core\Data\Helper\MakeLevelsFitter: ~
  XC\AutoImportBase\Core\Data\Helper\MakeLevelsHelper:
    class: XC\AutoImportBase\Core\Data\Helper\MakeLevelsHelper
    public: true

  XC\AutoImportBase\Core\Data\Updater\CategoryMapUpdater:
    class: XC\AutoImportBase\Core\Data\Updater\CategoryMapUpdater
    public: true

  xc.auto_import_base.importVehicleEventStateManager:
    class: XC\AutoImportBase\Core\Manager\ProcessEventStateManager
    public: true
    arguments:
      - '@xc.autoimportbase.repository.tmpvar'
      - '%autoimport.background.process.import.vehicles.option.name%'

  xc.auto_import_base.reAssignStockEventStateManager:
    class: XC\AutoImportBase\Core\Manager\ProcessEventStateManager
    public: true
    arguments:
      - '@xc.autoimportbase.repository.tmpvar'
      - '%autoimport.background.process.re.assign.stock.option.name%'

  XC\AutoImportBase\Core\Manager\ReAssignStockManager:
    class: XC\AutoImportBase\Core\Manager\ReAssignStockManager
    public: true
    arguments:
      - '@xc.auto_import_base.reassign_import_status_storage'
      - '@xc.auto_import_base.reAssignStockEventStateManager'

  xc.auto_import_base.reassign_import_status_storage:
    class: XC\AutoImportBase\Core\Data\Storage\SubBlockImportStatusStorage
    public: true
    arguments:
      $moduleId: 'XC-AutoImportBase'
      $optionName: 'ReassignStatus'
      $statusRepo: '@xc.autoimportbase.repository.sub_block_import_status'

  XC\AutoImportBase\Core\Manager\ImportVehiclesManager:
    class: XC\AutoImportBase\Core\Manager\ImportVehiclesManager
    public: true
    arguments:
      $eventManager: '@xc.auto_import_base.importVehicleEventStateManager'
      $integrationsManager: '@XC\AutoImportBase\Core\Manager\IntegrationsManager'

  XC\AutoImportBase\Core\Manager\IntegrationsManager:
    class: XC\AutoImportBase\Core\Manager\IntegrationsManager
    public: true
    arguments:
      $integrations: !tagged_iterator {tag: 'xc.autoimportbase.integration.settings'}
      $logger: '@xc.auto_import_base.logger'

  XC\AutoImportBase\EntityCallback\ScheduleSettingOptionCallback:
    tags:
      - {name: doctrine.orm.entity_listener, event: prePersist, entity: XC\AutoImportBase\Model\ScheduleSettingOption}
      - {name: doctrine.orm.entity_listener, event: preUpdate, entity: XC\AutoImportBase\Model\ScheduleSettingOption}

  XC\AutoImportBase\EntityCallback\ProductCallback:
    tags:
      - { name: doctrine.orm.entity_listener, event: preRemove, entity: XLite\Model\Product }

  XC\AutoImportBase\EntityCallback\ProductChangedManuallyFieldCallback:
    tags:
      - {name: doctrine.orm.entity_listener, event: preUpdate, entity: XLite\Model\Product}

  XC\AutoImportBase\Core\Task\ImportScheduleTask:
    tags:
      - {name: kernel.event_listener, event: xcart.cronjob, method: handleTask}

  XC\AutoImportBase\Core\Task\LoadResourcesTask:
    tags:
      - {name: kernel.event_listener, event: xcart.cronjob, method: handleTask}

  XC\AutoImportBase\Core\Manager\CategoryMapManager:
    class: XC\AutoImportBase\Core\Manager\CategoryMapManager
    public: true
    arguments:
      $integrationsManager: '@XC\AutoImportBase\Core\Manager\IntegrationsManager'

  XC\AutoImportBase\Core\Data\Factory\ScheduleDateTimeHelperFactory: ~
  XC\AutoImportBase\Core\Helper\ScheduleDateTimeHelper:
    class: XC\AutoImportBase\Core\Helper\ScheduleDateTimeHelper
    public: true
    factory: ['@XC\AutoImportBase\Core\Data\Factory\ScheduleDateTimeHelperFactory', 'create']
    arguments:
      $config: '@xcart.core.config'

  XC\AutoImportBase\Core\Data\Helper\ScheduleSettingsHelper:
    class: XC\AutoImportBase\Core\Data\Helper\ScheduleSettingsHelper
    public: true
    arguments:
      $scheduleSettingRepo: '@xc.autoimportbase.repository.schedule_settings'
      $scheduleSettingOptionRepo: '@xc.autoimportbase.repository.schedule_setting_option'

  XC\AutoImportBase\Core\Data\Converter\ScheduleSettingDTOConverter:
    class: XC\AutoImportBase\Core\Data\Converter\ScheduleSettingDTOConverter
    public: true

  XC\AutoImportBase\Core\Configuration\ScheduleSettingConfig:
    class: XC\AutoImportBase\Core\Configuration\ScheduleSettingConfig
    public: true
    arguments:
      $scheduleSettingsHelper: '@XC\AutoImportBase\Core\Data\Helper\ScheduleSettingsHelper'
      $scheduleSettingDTOConverter: '@XC\AutoImportBase\Core\Data\Converter\ScheduleSettingDTOConverter'

  XC\AutoImportBase\Core\Data\Creator\ShopByBrandCreator: ~

  XC\AutoImportBase\Core\Command\Constraints\ShouldProcessProductByImportModeConstraint: ~

  XC\AutoImportBase\Core\Data\Helper\CategoryPathHelper: ~

  XC\AutoImportBase\Core\Manager\MappedTreeInitializer:
    class: 'XC\AutoImportBase\Core\Manager\MappedTreeInitializer'
    public: true
    arguments:
      $categoryPathHelper: '@XC\AutoImportBase\Core\Data\Helper\CategoryPathHelper'
      $categoryRepo: '@xcart.repository.category'

  XC\AutoImportBase\Core\Provider\CategoryMapWidgetBuilder:
    class: XC\AutoImportBase\Core\Provider\CategoryMapWidgetBuilder
    public: true

  XC\AutoImportBase\Core\Metadata\LocalEntityConditionFactory:
    class: XC\AutoImportBase\Core\Metadata\LocalEntityUpdateModeConditionFactory
    public: true

  XC\AutoImportBase\Core\Command\BlockImport\Updater\BatchProductsUpdater:
    class: XC\AutoImportBase\Core\Command\BlockImport\Updater\AutoBatchProductsUpdater
    public: true

  XC\AutoImportBase\Core\Command\BlockImport\Updater\GenericProductUpdater:
    class: XC\AutoImportBase\Core\Command\BlockImport\Updater\AutoGenericProductUpdater
    public: true

  XC\AutoImportBase\Core\Provider\IProductStockListProvider:
    class: XC\AutoImportBase\Core\Provider\ProductStockListProvider
    public: true
    arguments:
      $productLocationStockRepo: '@xc.autoimportbase.repository.product_location_stock'
      $warehousesRepo: '@xc.autoimportbase.repository.integration_warehouse'

  XC\AutoImportBase\Core\Provider\RequestProductStockListProvider:
    class: XC\AutoImportBase\Core\Provider\RequestProductStockListProvider
    public: true

  XC\AutoImportBase\Core\Helper\ScheduleActionsStorage:
    class: XC\AutoImportBase\Core\Helper\ScheduleActionsStorage
    public: true

  XC\AutoImportBase\Core\Manager\SupplierReAssignScheduler:
    class: XC\AutoImportBase\Core\Manager\SupplierReAssignScheduler
    public: true

  XC\AutoImportBase\Core\Data\Updater\ActiveStockStrategy:
    class: XC\AutoImportBase\Core\Data\Updater\ExistingStockWithTopPriorityStockStrategy
    public: true
    arguments:
      $integrationPriorityRepo: "@xc.autoimportbase.repository.integration_priority"

  XC\AutoImportBase\Core\Data\Updater\StockAndPriceUpdater:
    class: XC\AutoImportBase\Core\Data\Updater\StockAndPriceUpdater
    public: true
    arguments:
      $logger: '@xc.auto_import_base.logger'

  xc.autoimportbase.repository.integration_priority:
    class: XC\AutoImportBase\Model\Repo\IntegrationPriority
    factory: ['@doctrine.orm.default_entity_manager', getRepository]
    public: true
    arguments:
      - XC\AutoImportBase\Model\IntegrationPriority

  xc.autoimportbase.repository.product_location_stock:
    class: XC\AutoImportBase\Model\Repo\ProductLocationStock
    factory: ['@doctrine.orm.default_entity_manager', getRepository]
    public: true
    arguments:
      - XC\AutoImportBase\Model\ProductLocationStock

  xc.autoimportbase.repository.integration_warehouse:
    class: XC\AutoImportBase\Model\Repo\IntegrationWarehouse
    factory: ['@doctrine.orm.default_entity_manager', getRepository]
    public: true
    arguments:
      - XC\AutoImportBase\Model\IntegrationWarehouse

  xc.autoimportbase.raw.config.helper:
    class: XC\AutoImportBase\Core\Helper\RawConfigHelper
    arguments:
      $integrationModuleId: 'XC-AutoImportBase'

  XC\AutoImportBase\Core\Configuration\AutoImportBaseConfiguration:
    class: XC\AutoImportBase\Core\Configuration\AutoImportBaseConfiguration
    public: true
    arguments:
      $rawConfigHelper: '@xc.autoimportbase.raw.config.helper'
      $currencyRepo: '@xc.autoimportbase.repository.currency'

  XC\AutoImportBase\Core\Data\Updater\ProductChangedManuallyFieldUpdater:
    class: XC\AutoImportBase\Core\Data\Updater\ProductChangedManuallyFieldUpdater
    public: true

  XC\AutoImportBase\Core\Manager\DiscontinuedProductsStrategy:
    class: XC\AutoImportBase\Core\Manager\DisableDiscontinuedProductsStrategy
    arguments:
      $productRepo: '@xcart.repository.product'

  XC\AutoImportBase\Core\Manager\DiscontinuedProductsManager:
    class: XC\AutoImportBase\Core\Manager\DiscontinuedProductsManager
    public: true

  XC\AutoImportBase\Core\Helper\StockTimeHelper:
    class: XC\AutoImportBase\Core\Helper\StockTimeHelper
    public: true

framework:
  messenger:
    transports:
      async_auto_import_base_commands:
        dsn: '%env(MESSENGER_TRANSPORT_DSN)%'
        serializer: XCart\Messenger\Serializer
        options:
          queue_name: auto_import_base

    routing:
      'XC\AutoImportBase\Messenger\Message\ExecuteCommand': async_auto_import_base_commands

x_cart:
  transports_data:
    async_auto_import_base_commands:
      moduleId: XC-AutoImportBase
      description: 'Re-assign suppliers (price and stock) for products.'
