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

services:
  _defaults:
    public: true

  mbo.externalcontent.provider:
    class: 'PrestaShop\Module\Mbo\ExternalContentProvider\ExternalContentProvider'

  mbo.adapter.module_collection_data_provider:
    class: 'PrestaShop\Module\Mbo\ModuleCollectionDataProvider'
    arguments:
      - '@prestashop.core.admin.data_provider.module_interface'
      - '@prestashop.core.admin.module.repository'
      - '@prestashop.adapter.presenter.module'
      - '@prestashop.core.admin.tab.repository'
      - '@prestashop.adapter.legacy.context'

  mbo.tab.collection.factory:
    class: 'PrestaShop\Module\Mbo\Tab\TabCollectionFactory'
    arguments:
      - '@mbo.adapter.module_collection_data_provider'

  mbo.tab.collection.provider:
    class: 'PrestaShop\Module\Mbo\Tab\TabCollectionProvider'
    arguments:
      - '@prestashop.adapter.legacy.context'
      - '@mbo.externalcontent.provider'
      - '@mbo.tab.collection.factory'
      - '@doctrine.cache.provider'

  mbo.recommendedlinks.provider:
    class: 'PrestaShop\Module\Mbo\RecommendedLink\RecommendedLinkProvider'
    arguments:
      - '@prestashop.adapter.legacy.context'
      - '@serializer'

  mbo.recommendedmodules.presenter:
    class: 'PrestaShop\Module\Mbo\RecommendedModule\RecommendedModulePresenter'

  mbo.addons_selection_link_provider:
    class: 'PrestaShop\Module\Mbo\AddonsSelectionLinkProvider'
    arguments:
      - '@prestashop.core.foundation.version'
      - '@prestashop.adapter.legacy.context'
      - '@prestashop.adapter.legacy.configuration'
      - '@request_stack'

  mbo.controller.modules:
      class: 'PrestaShop\Module\Mbo\Controller\Admin\ModuleController'

  mbo.controller.modules.catalog:
    class: 'PrestaShop\Module\Mbo\Controller\Admin\ModuleCatalogController'

  mbo.controller.modules.selection:
    class: 'PrestaShop\Module\Mbo\Controller\Admin\ModuleSelectionController'
    arguments:
      - '@request_stack'
      - '@mbo.externalcontent.provider'
      - '@mbo.addons_selection_link_provider'

  mbo.controller.modules.recommended:
    class: 'PrestaShop\Module\Mbo\Controller\Admin\ModuleRecommendedController'
    arguments:
      - '@request_stack'
      - '@mbo.tab.collection.provider'
      - '@mbo.recommendedmodules.presenter'

  mbo.controller.themes.catalog:
    class: 'PrestaShop\Module\Mbo\Controller\Admin\ThemeCatalogController'
    arguments:
      - '@request_stack'
      - '@mbo.externalcontent.provider'
      - '@mbo.addons_selection_link_provider'

  mbo.controller.security:
      class: 'PrestaShop\Module\Mbo\Controller\Admin\SecurityController'

  mbo.event_subscriber.module_event_subscriber:
      class: PrestaShop\Module\Mbo\EventSubscriber\ModuleEventSubscriber
      arguments:
          - '@logger'
      tags:
          - { name: kernel.event_subscriber }

  mbo.cdc.context_builder:
      class: PrestaShop\Module\Mbo\Service\View\ContextBuilder
      arguments:
          - '@prestashop.adapter.legacy.context'
          - '@prestashop.core.admin.module.repository'
          - '@router'
          - '@mbo.cdc.distribution_authentication_provider'
          - '@doctrine.cache.provider'
          - '@mbo.accounts.data_provider'

  mbo.distribution_api.client.http:
      class: GuzzleHttp\Client
      arguments:
          $config:
              base_url: "%env(DISTRIBUTION_API_URL)%"
              timeout: "7200"
              headers:
                  Accept: "application/json"
              CURLOPT_FORBID_REUSE: true
              CURLOPT_FRESH_CONNECT: true

  mbo.doctrine.cache.adapter:
      class: Symfony\Component\Cache\Adapter\FilesystemAdapter
      arguments:
          - ''
          - 0
          - "%ps_cache_dir%%/ps_mbo"

  mbo.doctrine.cache.provider:
      class: Symfony\Component\Cache\DoctrineProvider
      arguments:
          - "@mbo.doctrine.cache.adapter"

  mbo.cdc.client.distribution_api:
      class: PrestaShop\Module\Mbo\Distribution\Client
      arguments:
          - "@mbo.distribution_api.client.http"
          - '@mbo.doctrine.cache.provider'

  mbo.cdc.distribution_authentication_provider:
      class: PrestaShop\Module\Mbo\Distribution\AuthenticationProvider
      arguments:
          - '@mbo.doctrine.cache.provider'

  mbo.addons.user.credentials_encryptor:
      class: PrestaShop\Module\Mbo\Addons\User\CredentialsEncryptor

  mbo.addons.user:
      class: PrestaShop\Module\Mbo\Addons\User\AddonsUser
      arguments:
          - '@session'
          - '@mbo.addons.user.credentials_encryptor'
          - '@mbo.accounts.data_provider'
