# https://github.com/derhansen/xclass_di/issues/1
services:
  _defaults:
    autowire: true
    autoconfigure: true
    public: false

  HFC\Import\:
    resource: '../Classes/*'

  HFC\Import\Reaction\ClearCacheReaction:
    tags: [ 'reactions.reaction' ]
    public: true

  HFC\Import\Reaction\UpdateProductReaction:
    tags: [ 'reactions.reaction' ]
    public: true

  HFC\Import\EventListener\MaWiValidationErrorEventListener:
    tags:
      - name: event.listener
        identifier: 'hfcimport--mawi-validation-error-listener'
        event: HFC\Import\Event\MaWiValidationErrorEvent

  HFC\Import\EventListener\BeforePaymentEventListener:
    tags:
      - name: event.listener
        identifier: 'hfcimport--create-preorder-in-mawi'
        event: Extcode\Cart\Event\Order\PaymentEvent
        before: 'cart-unzerpayment--order--payment--provider-redirect'
        # after: 'cart--order--create--persist-order--shipping'

  HFC\Import\EventListener\OrderFinishedEventListener:
    tags:
      - name: event.listener
        identifier: 'hfcimport--order-finished--send-to-mawi'
        event: Extcode\Cart\Event\Order\FinishEvent
        after: 'muthsevshop--order-finished-event-listener'

#  HFC\Import\EventListener\OrderFinishedEventListener2:
#    class: HFC\Import\EventListener\OrderFinishedEventListener
#    tags:
#      - name: event.listener
#        identifier: 'hfcmembership--order-finished--send-to-mawi-after-unzer'
#        event: MUTHSEV\CartUnzerpayment\Event\Order\FinishEvent
#        after: 'muthsevshop--order-finished-event-listener'

  HFC\Import\Command\ImportProductsCommand:
    tags:
      - name: console.command
        command: 'hfcimport:import:products'
        description: 'Imports all products from Mawi.'

  HFC\Import\Command\ImportProductCommand:
    tags:
      - name: console.command
        command: 'hfcimport:import:product'
        description: 'Imports a single product from MaWi.'

  HFC\Import\Command\ImportProductImages:
    tags:
      - name: console.command
        command: 'hfcimport:import:all-product-images'
        description: 'Imports all product / article images'
