imports:
  - { resource: product/*.yml }

services:
  _defaults:
    public: true

  PrestaShop\PrestaShop\Adapter\Product\AdminProductDataProvider:
    decorates: prestashop.core.admin.data_provider.product_interface
    arguments:
      - "@doctrine.orm.entity_manager"
      - '@PrestaShop\PrestaShop\Adapter\ImageManager'
      - "@prestashop.static_cache.adapter"
    public: false
    deprecated: ~

  prestashop.adapter.admin.data_provider.product:
    alias: PrestaShop\PrestaShop\Adapter\Product\AdminProductDataProvider
    deprecated: ~

  PrestaShop\PrestaShop\Adapter\Product\AdminProductDataUpdater:
    class: PrestaShop\PrestaShop\Adapter\Product\AdminProductDataUpdater
    decorates: prestashop.core.admin.data_updater.product_interface
    public: false
    arguments:
      - '@PrestaShop\PrestaShop\Core\Hook\HookDispatcherInterface'
      - "@prestashop.static_cache.adapter"
    deprecated: ~

  prestashop.adapter.admin.data_updater.product:
    alias: PrestaShop\PrestaShop\Adapter\Product\AdminProductDataUpdater
    deprecated: ~

  PrestaShop\PrestaShop\Adapter\Product\AdminProductWrapper:
    arguments:
      - "@translator"
      - "@=service('prestashop.adapter.legacy.context').getContext().employee.getAssociatedShops()"
      - '@PrestaShop\PrestaShop\Core\Localization\LocaleInterface'
      - '@PrestaShopBundle\Utils\FloatParser'
    deprecated: ~

  prestashop.adapter.admin.wrapper.product:
    alias: PrestaShop\PrestaShop\Adapter\Product\AdminProductWrapper
    deprecated: ~

  PrestaShop\PrestaShop\Adapter\Attribute\AdminAttributeGeneratorControllerWrapper:
    deprecated: ~

  prestashop.adapter.admin.controller.attribute_generator:
    alias: PrestaShop\PrestaShop\Adapter\Attribute\AdminAttributeGeneratorControllerWrapper
    deprecated: ~

  PrestaShop\PrestaShop\Adapter\Product\FilterCategoriesRequestPurifier:
    deprecated: ~

  prestashop.adapter.product.filter_categories_request_purifier:
    alias: PrestaShop\PrestaShop\Adapter\Product\FilterCategoriesRequestPurifier
    deprecated: ~

  PrestaShop\PrestaShop\Adapter\Product\ListParametersUpdater:
    deprecated: ~

  prestashop.adapter.product.list_parameters_updater:
    alias: PrestaShop\PrestaShop\Adapter\Product\ListParametersUpdater
    deprecated: ~

  PrestaShop\PrestaShop\Adapter\Product\CommandHandler\AssignProductToCategoryHandler:
    autowire: true
    tags:
      - name: tactician.handler
        command: PrestaShop\PrestaShop\Core\Domain\Product\Command\AssignProductToCategoryCommand

  PrestaShop\PrestaShop\Adapter\Product\CommandHandler\UpdateProductStatusHandler:
    autowire: true
    tags:
      - name: tactician.handler
        command: PrestaShop\PrestaShop\Core\Domain\Product\Command\UpdateProductStatusCommand

  PrestaShop\PrestaShop\Adapter\Product\QueryHandler\SearchProductsHandler:
    arguments:
      - '@=service("PrestaShop\\PrestaShop\\Adapter\\LegacyContext").getContext().language.id'
      - '@PrestaShop\PrestaShop\Core\Localization\LocaleInterface'
      - '@PrestaShop\PrestaShop\Adapter\Tools'
      - '@PrestaShop\PrestaShop\Core\Currency\CurrencyDataProviderInterface'
      - '@PrestaShop\PrestaShop\Adapter\ContextStateManager'
    tags:
      - name: tactician.handler
        command: PrestaShop\PrestaShop\Core\Domain\Product\Query\SearchProducts

  PrestaShop\PrestaShop\Adapter\Product\QueryHandler\SearchProductsForAssociationHandler:
    autowire: true
    public: false
    tags:
      - name: tactician.handler
        command: PrestaShop\PrestaShop\Core\Domain\Product\Query\SearchProductsForAssociation

  PrestaShop\PrestaShop\Adapter\Product\QueryHandler\GetProductIsEnabledHandler:
    tags:
      - name: tactician.handler
        command: PrestaShop\PrestaShop\Core\Domain\Product\Query\GetProductIsEnabled

  PrestaShop\PrestaShop\Adapter\Product\Grid\Data\Factory\ProductGridDataFactoryDecorator:
    arguments:
      - '@prestashop.core.grid.data.factory.product'
      - '@PrestaShop\PrestaShop\Core\Localization\Locale\Repository'
      - '@=service("PrestaShop\\PrestaShop\\Adapter\\LegacyContext").getContext().language.getLocale()'
      - '@=service("PrestaShop\\PrestaShop\\Adapter\\Configuration").get("PS_CURRENCY_DEFAULT")'
      - '@PrestaShop\PrestaShop\Adapter\Tax\TaxComputer'
      - '@=service("PrestaShop\\PrestaShop\\Adapter\\LegacyContext").getContext().country.id'
      - '@PrestaShop\PrestaShop\Adapter\Product\Image\ProductImagePathFactory'
      - '@translator'
      - '@=service("PrestaShop\\PrestaShop\\Adapter\\Configuration").getBoolean("PS_TAX")'
      - '@=service("PrestaShop\\PrestaShop\\Adapter\\Configuration").getBoolean("PS_USE_ECOTAX")'
      - '@=service("PrestaShop\\PrestaShop\\Adapter\\Configuration").getInt("PS_ECOTAX_TAX_RULES_GROUP_ID")'
      - '@PrestaShop\PrestaShop\Adapter\Shop\Repository\ShopRepository'
      - '@PrestaShop\PrestaShop\Adapter\Product\Repository\ProductRepository'

  PrestaShop\PrestaShop\Adapter\Product\Grid\Data\Factory\ProductShopsGridDataFactoryDecorator:
    parent: PrestaShop\PrestaShop\Adapter\Product\Grid\Data\Factory\ProductGridDataFactoryDecorator
    arguments:
      $productGridDataFactory: '@prestashop.core.grid.data.factory.product.shops'
    public: false

  PrestaShop\PrestaShop\Adapter\Product\Grid\Data\Factory\ProductLightGridDataFactoryDecorator:
    arguments:
      - '@prestashop.core.grid.data.factory.product'
      - '@PrestaShop\PrestaShop\Core\Localization\Locale\Repository'
      - '@=service("PrestaShop\\PrestaShop\\Adapter\\LegacyContext").getContext().language.getLocale()'
      - '@=service("PrestaShop\\PrestaShop\\Adapter\\Configuration").get("PS_CURRENCY_DEFAULT")'
      - '@=service("PrestaShop\\PrestaShop\\Adapter\\Configuration").get("PS_STOCK_MANAGEMENT")'

  PrestaShop\PrestaShop\Adapter\Product\QueryHandler\GetProductForEditingHandler:
    autowire: true
    public: false
    arguments:
      $countryId: '@=service("PrestaShop\\PrestaShop\\Adapter\\Configuration").getInt("PS_COUNTRY_DEFAULT")'
    tags:
      - name: tactician.handler
        command: PrestaShop\PrestaShop\Core\Domain\Product\Query\GetProductForEditing

  PrestaShop\PrestaShop\Adapter\Product\CommandHandler\AddProductHandler:
    autowire: true
    public: false
    tags:
      - name: tactician.handler
        command: PrestaShop\PrestaShop\Core\Domain\Product\Command\AddProductCommand

  PrestaShop\PrestaShop\Adapter\Product\CommandHandler\SetProductTagsHandler:
    autowire: true
    public: false
    tags:
      - name: tactician.handler
        command: PrestaShop\PrestaShop\Core\Domain\Product\Command\SetProductTagsCommand

  PrestaShop\PrestaShop\Adapter\Product\CommandHandler\UpdateProductsPositionsHandler:
    arguments:
      - '@prestashop.core.grid.product.position_definition'
      - '@PrestaShop\PrestaShop\Core\Grid\Position\PositionUpdateFactoryInterface'
      - '@PrestaShop\PrestaShop\Core\Grid\Position\GridPositionUpdaterInterface'
    tags:
      - name: tactician.handler
        command: PrestaShop\PrestaShop\Core\Domain\Product\Command\UpdateProductsPositionsCommand

  PrestaShop\PrestaShop\Adapter\Product\CommandHandler\RemoveAllProductTagsHandler:
    autowire: true
    public: false
    tags:
      - name: tactician.handler
        command: PrestaShop\PrestaShop\Core\Domain\Product\Command\RemoveAllProductTagsCommand

  PrestaShop\PrestaShop\Adapter\Product\CommandHandler\SetAssociatedProductCategoriesHandler:
    arguments:
      - '@PrestaShop\PrestaShop\Adapter\Product\Update\ProductCategoryUpdater'
    tags:
      - name: tactician.handler
        command: PrestaShop\PrestaShop\Core\Domain\Product\Command\SetAssociatedProductCategoriesCommand

  PrestaShop\PrestaShop\Adapter\Product\CommandHandler\RemoveAllAssociatedProductCategoriesHandler:
    autowire: true
    tags:
      - name: tactician.handler
        command: PrestaShop\PrestaShop\Core\Domain\Product\Command\RemoveAllAssociatedProductCategoriesCommand

  PrestaShop\PrestaShop\Adapter\Product\CommandHandler\SetCarriersHandler:
    autowire: true
    public: false
    tags:
      - name: tactician.handler
        command: PrestaShop\PrestaShop\Core\Domain\Product\Command\SetCarriersCommand

  PrestaShop\PrestaShop\Adapter\Product\QueryHandler\GetProductSupplierOptionsHandler:
    autowire: true
    public: false
    tags:
      - name: tactician.handler
        command: PrestaShop\PrestaShop\Core\Domain\Product\Supplier\Query\GetProductSupplierOptions

  PrestaShop\PrestaShop\Adapter\Product\Supplier\QueryHandler\GetAssociatedSuppliersHandler:
    arguments:
      - '@PrestaShop\PrestaShop\Adapter\Product\Repository\ProductSupplierRepository'
    tags:
      - name: tactician.handler
        command: PrestaShop\PrestaShop\Core\Domain\Product\Supplier\Query\GetAssociatedSuppliers

  PrestaShop\PrestaShop\Adapter\Product\Supplier\CommandHandler\SetSuppliersHandler:
    arguments:
      - '@PrestaShop\PrestaShop\Adapter\Product\Update\ProductSupplierUpdater'
    tags:
      - name: tactician.handler
        command: PrestaShop\PrestaShop\Core\Domain\Product\Supplier\Command\SetSuppliersCommand

  PrestaShop\PrestaShop\Adapter\Product\Supplier\CommandHandler\SetProductDefaultSupplierHandler:
    arguments:
      - '@PrestaShop\PrestaShop\Adapter\Product\Update\ProductSupplierUpdater'
    tags:
      - name: tactician.handler
        command: PrestaShop\PrestaShop\Core\Domain\Product\Supplier\Command\SetProductDefaultSupplierCommand

  PrestaShop\PrestaShop\Adapter\Product\Supplier\CommandHandler\UpdateProductSuppliersHandler:
    arguments:
      - '@PrestaShop\PrestaShop\Adapter\Product\Update\ProductSupplierUpdater'
      - '@PrestaShop\PrestaShop\Adapter\Product\Repository\ProductSupplierRepository'
    tags:
      - name: tactician.handler
        command: PrestaShop\PrestaShop\Core\Domain\Product\Supplier\Command\UpdateProductSuppliersCommand

  PrestaShop\PrestaShop\Adapter\Product\Supplier\CommandHandler\RemoveAllAssociatedProductSuppliersHandler:
    arguments:
      - '@PrestaShop\PrestaShop\Adapter\Product\Update\ProductSupplierUpdater'
    tags:
      - name: tactician.handler
        command: PrestaShop\PrestaShop\Core\Domain\Product\Supplier\Command\RemoveAllAssociatedProductSuppliersCommand

  PrestaShop\PrestaShop\Adapter\Product\Update\ProductAttachmentUpdater:
    autowire: true
    public: false

  PrestaShop\PrestaShop\Adapter\Product\Validate\ProductValidator:
    autowire: true
    public: false

  PrestaShop\PrestaShop\Adapter\Product\Repository\ProductRepository:
    autowire: true
    arguments:
      - '@doctrine.dbal.default_connection'
      - '%database_prefix%'

  PrestaShop\PrestaShop\Adapter\Product\Update\ProductTypeUpdater:
    autowire: true
    public: false

  PrestaShop\PrestaShop\Adapter\Product\CommandHandler\DeleteProductHandler:
    autowire: true
    public: false
    tags:
      - name: tactician.handler
        command: PrestaShop\PrestaShop\Core\Domain\Product\Command\DeleteProductCommand

  PrestaShop\PrestaShop\Adapter\Product\CommandHandler\BulkDeleteProductHandler:
    autowire: true
    public: false
    tags:
      - name: tactician.handler
        command: PrestaShop\PrestaShop\Core\Domain\Product\Command\BulkDeleteProductCommand

  PrestaShop\PrestaShop\Adapter\Product\CommandHandler\BulkDuplicateProductHandler:
    arguments:
      - '@PrestaShop\PrestaShop\Adapter\Product\Update\ProductDuplicator'
    tags:
      - name: tactician.handler
        command: PrestaShop\PrestaShop\Core\Domain\Product\Command\BulkDuplicateProductCommand

  PrestaShop\PrestaShop\Adapter\Product\CommandHandler\BulkUpdateProductStatusHandler:
    autowire: true
    tags:
      - name: tactician.handler
        command: PrestaShop\PrestaShop\Core\Domain\Product\Command\BulkUpdateProductStatusCommand

  PrestaShop\PrestaShop\Adapter\Product\Attachment\CommandHandler\SetAssociatedProductAttachmentsHandler:
    arguments:
      - '@PrestaShop\PrestaShop\Adapter\Product\Update\ProductAttachmentUpdater'
    tags:
      - name: tactician.handler
        command: PrestaShop\PrestaShop\Core\Domain\Product\Attachment\Command\SetAssociatedProductAttachmentsCommand

  PrestaShop\PrestaShop\Adapter\Product\Attachment\CommandHandler\RemoveAllAssociatedProductAttachmentsHandler:
    arguments:
      - '@PrestaShop\PrestaShop\Adapter\Product\Update\ProductAttachmentUpdater'
    tags:
      - name: tactician.handler
        command: PrestaShop\PrestaShop\Core\Domain\Product\Attachment\Command\RemoveAllAssociatedProductAttachmentsCommand

  PrestaShop\PrestaShop\Adapter\Product\Validate\ProductSupplierValidator:
    autowire: true
    public: false

  PrestaShop\PrestaShop\Adapter\Product\Repository\ProductSupplierRepository:
    arguments:
      - '@doctrine.dbal.default_connection'
      - '%database_prefix%'
      - '@PrestaShop\PrestaShop\Adapter\Product\Validate\ProductSupplierValidator'

  PrestaShop\PrestaShop\Adapter\Product\Update\ProductSupplierUpdater:
    autowire: true
    public: false
    arguments:
      $defaultCurrencyId: '@=service("PrestaShop\\PrestaShop\\Adapter\\Configuration").get("PS_CURRENCY_DEFAULT")'

  PrestaShop\PrestaShop\Adapter\Product\Update\RelatedProductsUpdater:
    autowire: true
    public: false

  PrestaShop\PrestaShop\Adapter\Product\CommandHandler\SetRelatedProductsHandler:
    arguments:
      - '@PrestaShop\PrestaShop\Adapter\Product\Update\RelatedProductsUpdater'
    tags:
      - name: tactician.handler
        command: PrestaShop\PrestaShop\Core\Domain\Product\Command\SetRelatedProductsCommand

  PrestaShop\PrestaShop\Adapter\Product\QueryHandler\GetRelatedProductsHandler:
    autowire: true
    public: false
    tags:
      - name: tactician.handler
        command: PrestaShop\PrestaShop\Core\Domain\Product\Query\GetRelatedProducts

  PrestaShop\PrestaShop\Adapter\Product\CommandHandler\RemoveAllRelatedProductsHandler:
    arguments:
      - '@PrestaShop\PrestaShop\Adapter\Product\Update\RelatedProductsUpdater'
    tags:
      - name: tactician.handler
        command: PrestaShop\PrestaShop\Core\Domain\Product\Command\RemoveAllRelatedProductsCommand

  PrestaShop\PrestaShop\Adapter\Product\Repository\TagRepository:
    arguments:
      - '@doctrine.dbal.default_connection'
      - '%database_prefix%'

  PrestaShop\PrestaShop\Adapter\Product\Update\ProductTagUpdater:
    arguments:
      - '@PrestaShop\PrestaShop\Adapter\Product\Repository\TagRepository'
      - '@PrestaShop\PrestaShop\Adapter\Product\Update\ProductIndexationUpdater'

  PrestaShop\PrestaShop\Adapter\Product\Update\ProductCategoryUpdater:
    autowire: true
    public: false

  PrestaShop\PrestaShop\Adapter\Product\CommandHandler\DuplicateProductHandler:
    arguments:
      - '@PrestaShop\PrestaShop\Adapter\Product\Update\ProductDuplicator'
    tags:
      - name: tactician.handler
        command: PrestaShop\PrestaShop\Core\Domain\Product\Command\DuplicateProductCommand

  PrestaShop\PrestaShop\Adapter\Product\Update\ProductDuplicator:
    autowire: true
    arguments:
      $connection: '@doctrine.dbal.default_connection'
      $dbPrefix: '%database_prefix%'
      $productImageSystemPathFactory: '@prestashop.adapter.product.image.product_image_filesystem_path_factory'

  PrestaShop\PrestaShop\Adapter\Product\CommandHandler\UpdateProductTypeHandler:
    arguments:
      - '@PrestaShop\PrestaShop\Adapter\Product\Update\ProductTypeUpdater'
    tags:
      - name: tactician.handler
        command: PrestaShop\PrestaShop\Core\Domain\Product\Command\UpdateProductTypeCommand

  PrestaShop\PrestaShop\Adapter\Product\Update\ProductIndexationUpdater:
    arguments:
      - '@PrestaShop\PrestaShop\Adapter\ContextStateManager'
      - '@=service("PrestaShop\\PrestaShop\\Adapter\\Configuration").getBoolean("PS_SEARCH_INDEXATION")'

  PrestaShop\PrestaShop\Adapter\Product\Repository\ProductPreviewRepository:
    autowire: true
    public: false

  PrestaShop\PrestaShop\Adapter\Product\Update\ProductShopUpdater:
    autowire: true
    public: false

  PrestaShop\PrestaShop\Adapter\Product\Shop\CommandHandler\SetProductShopsHandler:
    autowire: true
    public: false
    tags:
      - name: tactician.handler
        command: PrestaShop\PrestaShop\Core\Domain\Product\Shop\Command\SetProductShopsCommand

  PrestaShop\PrestaShop\Adapter\Product\CommandHandler\UpdateProductHandler:
    autowire: true
    public: false
    arguments:
      $productUpdatablePropertyFiller: '@PrestaShop\PrestaShop\Adapter\Product\Update\Filler\ProductFiller'
    tags:
      - name: tactician.handler
        command: PrestaShop\PrestaShop\Core\Domain\Product\Command\UpdateProductCommand

  PrestaShop\PrestaShop\Adapter\Product\Stock\CommandHandler\UpdateProductStockAvailableHandler:
    autowire: true
    public: false
    tags:
      - name: tactician.handler
        command: PrestaShop\PrestaShop\Core\Domain\Product\Stock\Command\UpdateProductStockAvailableCommand

  PrestaShop\PrestaShop\Adapter\Product\Update\Filler\ProductFiller:
    arguments:
      - !tagged core.product_filler

  PrestaShop\PrestaShop\Adapter\Product\Update\Filler\BasicInformationFiller:
    arguments:
      - '@=service("PrestaShop\\PrestaShop\\Adapter\\Configuration").get("PS_LANG_DEFAULT")'
    tags:
      # its important that BasicInformationFiller is prioritized before the SeoFiller, because of link_rewrite overriding
      - { name: 'core.product_filler', priority: 10 }

  PrestaShop\PrestaShop\Adapter\Product\Update\Filler\OptionsFiller:
    tags: [ 'core.product_filler' ]

  PrestaShop\PrestaShop\Adapter\Product\Update\Filler\PricesFiller:
    tags: [ 'core.product_filler' ]
    arguments:
      - '@PrestaShop\PrestaShop\Core\Util\Number\NumberExtractor'
      - '@PrestaShop\PrestaShop\Adapter\Configuration'

  PrestaShop\PrestaShop\Adapter\Product\Update\Filler\SeoFiller:
    tags: [ 'core.product_filler' ]
    autowire: true
    public: false

  PrestaShop\PrestaShop\Adapter\Product\Update\Filler\DetailsFiller:
    tags: [ 'core.product_filler' ]

  PrestaShop\PrestaShop\Adapter\Product\Update\Filler\ShippingFiller:
    tags: [ 'core.product_filler' ]

  PrestaShop\PrestaShop\Adapter\Product\Update\Filler\StockInformationFiller:
    tags: [ 'core.product_filler' ]

  PrestaShop\PrestaShop\Adapter\Product\ProductDeleter:
    autowire: true
    public: false
