services:
  _defaults:
    autowire: true
    autoconfigure: true
    public: false

  MUTHSEV\Shop\:
    resource: '../Classes/*'

  MUTHSEV\Shop\Service\PriceService:
    public: true

  MUTHSEV\Shop\EventListener\UserAccount\AugmentNavMenuItems:
    tags:
      - name: event.listener
        identifier: 'muthsevshop--user-account--augment-user-account-nav-menu'
        event: MUTHSEV\Members\Event\ModifyUserAccountNavMenuItemsEvent
        after: 'muthsevmembers--user-account--augment-user-account-nav-menu'

  # Attach a customer / contact to an order after it has been placed
  MUTHSEV\Shop\EventListener\OrderFinishedEventListener:
    tags:
      - name: event.listener
        identifier: 'muthsevshop--order-finished-event-listener'
        event: Extcode\Cart\Event\Order\FinishEvent

# todo: use constructor injection
#  MUTHSEV\Shop\Service\CartService:
#    arguments:
#      $priceService: '@MUTHSEV\Shop\Service\PriceService'

  Extcode\CartProducts\Controller\ProductController:
    alias: MUTHSEV\Shop\XClass\CartProducts\Controller\ProductController
    public: true

  Extcode\Cart\Controller\Cart\CartController:
    alias: MUTHSEV\Shop\XClass\Cart\Controller\Cart\CartController
    public: true

  Extcode\Cart\Controller\Order\OrderController:
    alias: MUTHSEV\Shop\XClass\Cart\Controller\Order\OrderController
    public: true

  connection.tx_cartproducts_domain_model_product_product:
    class: 'TYPO3\CMS\Core\Database\Connection'
    factory: ['@TYPO3\CMS\Core\Database\ConnectionPool', 'getConnectionForTable']
    arguments: ['tx_cartproducts_domain_model_product_product']

  connection.tx_cart_domain_model_tag:
    class: 'TYPO3\CMS\Core\Database\Connection'
    factory: ['@TYPO3\CMS\Core\Database\ConnectionPool', 'getConnectionForTable']
    arguments: ['tx_cart_domain_model_tag']

  connection.sys_category:
    class: 'TYPO3\CMS\Core\Database\Connection'
    factory: ['@TYPO3\CMS\Core\Database\ConnectionPool', 'getConnectionForTable']
    arguments: ['sys_category']

  MUTHSEV\Shop\Domain\Repository\ProductTagRepository:
    arguments:
      $connection: '@connection.tx_cart_domain_model_tag'

  MUTHSEV\Shop\Domain\Repository\ProductCategoryRepository:
    arguments:
      $connection: '@connection.sys_category'
