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

dto_generator:
  entities:
    api:
      XCart\API\Entity\Storefront\Product\Compact:
        fields:
          canBeBackordered:
            type: bool
          backorderQtyLabel:
            type: string
          isLimitedBackorder:
            type: bool
          backorderLimit:
            type: integer

      XCart\API\Entity\Storefront\Product\Detailed:
        fields:
          canBeBackordered:
            type: bool
          backorderQtyLabel:
            type: string
          isLimitedBackorder:
            type: bool
          backorderLimit:
            type: integer

    logic:
      XCart\Logic\Entity\Storefront\Product:
        fields:
          canBeBackordered:
            type: bool
          backorderQtyLabel:
            type: string
            nullable: true
          isLimitedBackorder:
            type: bool
            nullable: true
          backorderLimit:
            type: integer
            nullable: true

services:
  _defaults:
    autowire: true
    autoconfigure: true

  QSL\Backorder\Core\EventListener:
    arguments:
      $moduleManagerDomain: '@XCart\Domain\ModuleManagerDomain'
    tags:
      - {name: kernel.event_listener, event: xcart.service.view-list.collect-mutation, method: onCollectViewListMutations}
      - {name: kernel.event_listener, event: xcart.service.view-list.collect-mutation.after, method: onCollectViewListMutationsAfter}

  QSL\Backorder\Transformer\XLite\Model\Product\Logic\Entity\Storefront\ProductDecorator:
    decorates: XCart\Transformer\XLite\Model\Product\Logic\Entity\Storefront\Product
