services:
  _defaults:
    public: true

  prestashop.adapter.cart.command_handler.create_empty_customer_cart_handler:
    class: 'PrestaShop\PrestaShop\Adapter\Cart\CommandHandler\CreateEmptyCustomerCartHandler'
    autoconfigure: true

  prestashop.adapter.cart.command_handler.update_cart_currency_handler:
    class: 'PrestaShop\PrestaShop\Adapter\Cart\CommandHandler\UpdateCartCurrencyHandler'
    autoconfigure: true

  prestashop.adapter.cart.command_handler.update_cart_language_handler:
    class: 'PrestaShop\PrestaShop\Adapter\Cart\CommandHandler\UpdateCartLanguageHandler'
    autoconfigure: true

  prestashop.adapter.cart.command_handler.update_cart_addresses_handler:
    class: 'PrestaShop\PrestaShop\Adapter\Cart\CommandHandler\UpdateCartAddressesHandler'
    autoconfigure: true
    arguments:
      - '@prestashop.adapter.command_handler.update_cart_carrier_handler'

  prestashop.adapter.cart.command_handler.update_delivery_options_handler:
    class: 'PrestaShop\PrestaShop\Adapter\Cart\CommandHandler\UpdateCartDeliverySettingsHandler'
    autoconfigure: true
    arguments:
      - '@translator'
      - '@prestashop.adapter.legacy.configuration'

  prestashop.adapter.command_handler.update_product_quantity_in_cart_handler:
    class: 'PrestaShop\PrestaShop\Adapter\Cart\CommandHandler\UpdateProductQuantityInCartHandler'
    autoconfigure: true
    arguments:
      - '@prestashop.adapter.context_state_manager'

  prestashop.adapter.command_handler.update_cart_carrier_handler:
    class: 'PrestaShop\PrestaShop\Adapter\Cart\CommandHandler\UpdateCartCarrierHandler'
    autoconfigure: true
    arguments:
      - '@prestashop.adapter.context_state_manager'

  prestashop.adapter.command_handler.add_cart_rule_to_cart_handler:
    class: 'PrestaShop\PrestaShop\Adapter\Cart\CommandHandler\AddCartRuleToCartHandler'
    autoconfigure: true
    arguments:
      - '@prestashop.adapter.context_state_manager'

  prestashop.adapter.command_handler.remove_cart_rule_from_cart_handler:
    class: 'PrestaShop\PrestaShop\Adapter\Cart\CommandHandler\RemoveCartRuleFromCartHandler'
    autoconfigure: true

  prestashop.adapter.command_handler.remove_product_from_cart_handler:
    class: 'PrestaShop\PrestaShop\Adapter\Cart\CommandHandler\RemoveProductFromCartHandler'
    autoconfigure: true
    arguments:
      - '@prestashop.adapter.context_state_manager'

  prestashop.adapter.command_handler.update_product_price_in_cart_handler:
    class: 'PrestaShop\PrestaShop\Adapter\Cart\CommandHandler\UpdateProductPriceInCartHandler'
    autoconfigure: true

  prestashop.adapter.command_handler.send_cart_to_customer_handler:
    class: 'PrestaShop\PrestaShop\Adapter\Cart\CommandHandler\SendCartToCustomerHandler'
    deprecated:
      package: PrestaShop\PrestaShop
      version: 9.0
    autoconfigure: true

  prestashop.adapter.query_handler.get_cart_for_viewing_handler:
    class: 'PrestaShop\PrestaShop\Adapter\Cart\QueryHandler\GetCartForViewingHandler'
    autoconfigure: true
    arguments:
      - '@PrestaShop\PrestaShop\Adapter\ImageManager'
      - "@prestashop.core.localization.locale.context_locale"

  prestashop.adapter.cart.query_handler.get_last_empty_customer_cart_handler:
    class: 'PrestaShop\PrestaShop\Adapter\Cart\QueryHandler\GetLastEmptyCustomerCartHandler'
    autoconfigure: true

  prestashop.adapter.query_handler.get_cart_information_handler:
    class: 'PrestaShop\PrestaShop\Adapter\Cart\QueryHandler\GetCartForOrderCreationHandler'
    autoconfigure: true
    arguments:
      - "@prestashop.core.localization.locale.context_locale"
      - '@=service("prestashop.adapter.legacy.context").getContext().language.id'
      - '@=service("prestashop.adapter.legacy.context").getContext().link'
      - '@prestashop.adapter.context_state_manager'
      - '@=service("prestashop.adapter.legacy.configuration").getInt("PS_CARRIER_DEFAULT")'

  prestashop.adapter.command_handler.add_customization_handler:
    class: 'PrestaShop\PrestaShop\Adapter\Cart\CommandHandler\AddCustomizationHandler'
    autoconfigure: true

  prestashop.adapter.command_handler.add_product_to_cart_handler:
    class: 'PrestaShop\PrestaShop\Adapter\Cart\CommandHandler\AddProductToCartHandler'
    autoconfigure: true
    arguments:
      - '@prestashop.adapter.command_handler.add_customization_handler'
      - '@prestashop.adapter.command_handler.update_product_quantity_in_cart_handler'

  PrestaShop\PrestaShop\Adapter\Cart\CommandHandler\DeleteCartHandler:
    autoconfigure: true
    arguments:
      - '@PrestaShop\PrestaShop\Adapter\Cart\Repository\CartRepository'
      - '@PrestaShop\PrestaShop\Adapter\Order\Repository\OrderRepository'

  PrestaShop\PrestaShop\Adapter\Cart\CommandHandler\BulkDeleteCartHandler:
    autoconfigure: true
    arguments:
      - '@PrestaShop\PrestaShop\Adapter\Cart\Repository\CartRepository'
      - '@PrestaShop\PrestaShop\Adapter\Order\Repository\OrderRepository'

  PrestaShop\PrestaShop\Adapter\Cart\Repository\CartRepository:
    arguments:
      - '@doctrine.dbal.default_connection'
      - '%database_prefix%'
