services:
  prestashop.bundle.routing.module_route_loader:
    class: 'PrestaShopBundle\Routing\YamlModuleLoader'
    arguments:
      - '@=service("prestashop.adapter.module.repository.module_repository").getInstalledModulesPaths()'
    tags: [ routing.loader ]

  prestashop.bundle.routing.converter.legacy_url_converter:
    class: 'PrestaShopBundle\Routing\Converter\LegacyUrlConverter'
    public: true
    arguments:
      - '@router'
      - '@prestashop.bundle.routing.converter.cache_provider'

  PrestaShopBundle\Routing\Converter\LegacyParametersConverter:
    public: false

  prestashop.bundle.routing.converter.legacy_parameters_converter:
    alias: 'PrestaShopBundle\Routing\Converter\LegacyParametersConverter'
    public: true
    deprecated:
      package: PrestaShop\PrestaShop
      version: 9.0

  PrestaShopBundle\Routing\Converter\RouterProvider:
    autowire: true

  PrestaShopBundle\Routing\Converter\LegacyRouteFactory:
    autowire: true
    arguments:
      - '@PrestaShop\PrestaShop\Core\FeatureFlag\FeatureFlagStateCheckerInterface'

  # We set this alias so that we can override it in test environment (to avoid memory limit crashes)
  prestashop.bundle.routing.converter.cache:
    alias: cache.system

  prestashop.bundle.routing.converter.cache_provider:
    class: 'PrestaShopBundle\Routing\Converter\CacheProvider'
    arguments:
      - '@PrestaShopBundle\Routing\Converter\RouterProvider'
      - '@prestashop.bundle.routing.converter.cache'
      - '@prestashop.bundle.routing.converter.routing_cache_key_generator'

  prestashop.bundle.routing.converter.routing_cache_key_generator:
    class: 'PrestaShopBundle\Routing\Converter\RoutingCacheKeyGenerator'
    arguments:
      - [ "%kernel.project_dir%/src/PrestaShopBundle/Resources/config/routing/admin" ]
      - '@=service("prestashop.adapter.module.repository.module_repository").getActiveModulesPaths()'
      - '%kernel.environment%'

  prestashop.bundle.routing.linter.security_annotation_linter:
    class: 'PrestaShopBundle\Routing\Linter\SecurityAttributeLinter'
    arguments:
      - '@annotation_reader'
    public: true

  prestashop.bundle.routing.linter.naming_convention_linter:
    class: 'PrestaShopBundle\Routing\Linter\NamingConventionLinter'

  prestashop.bundle.routing.linter.legacy_link_linter:
    class: 'PrestaShopBundle\Routing\Linter\LegacyLinkLinter'

  prestashop.bundle.routing.linter.admin_route_provider:
    class: 'PrestaShopBundle\Routing\Linter\AdminRouteProvider'
    arguments:
      - '@router'

  PrestaShopBundle\Routing\LegacyRouterChecker:
    autoconfigure: true
    autowire: true
    public: false

  PrestaShopBundle\Routing\AnonymousRouteProvider:
    autowire: true
    autoconfigure: true
    public: false
    arguments:
      $router: '@router.default'
