services:
  # Underlying Symfony utilities for Composer Stager.
  Symfony\Component\Filesystem\Filesystem:
    public: false
  Symfony\Component\Process\ExecutableFinder:
    public: false

  # Basic infrastructure services for Composer Stager, overridden by us to
  # provide additional functionality.
  Drupal\package_manager\ProcessFactory:
    arguments:
      - '@file_system'
      - '@config.factory'
    public: false
  Drupal\package_manager\ExecutableFinder:
    arguments:
      $config_factory: '@config.factory'
    autowire: true
    public: false
  Drupal\package_manager\FileSyncerFactory:
    arguments:
      $config_factory: '@config.factory'
    autowire: true
    public: false
  PhpTuf\ComposerStager\Infrastructure\Service\Finder\ExecutableFinderInterface:
    alias: 'Drupal\package_manager\ExecutableFinder'
  PhpTuf\ComposerStager\Infrastructure\Factory\Process\ProcessFactoryInterface:
    alias: 'Drupal\package_manager\ProcessFactory'
  PhpTuf\ComposerStager\Domain\Service\FileSyncer\FileSyncerInterface:
    factory: ['@Drupal\package_manager\FileSyncerFactory', 'create']

  # Services provided to Drupal by Package Manager.
  package_manager.beginner:
    class: PhpTuf\ComposerStager\Domain\Core\Beginner\Beginner
    autowire: true
  package_manager.stager:
    class: PhpTuf\ComposerStager\Domain\Core\Stager\Stager
    autowire: true
  package_manager.committer:
    class: PhpTuf\ComposerStager\Domain\Core\Committer\Committer
    autowire: true
  package_manager.path_locator:
    class: Drupal\package_manager\PathLocator
    arguments:
      - '%app.root%'
      - '@config.factory'
      - '@file_system'

  # Validators.
  package_manager.validator.composer_executable:
    class: Drupal\package_manager\Validator\ComposerExecutableValidator
    arguments:
      - '@PhpTuf\ComposerStager\Domain\Service\ProcessRunner\ComposerRunnerInterface'
      - '@module_handler'
      - '@string_translation'
    tags:
      - { name: event_subscriber }
  package_manager.validator.disk_space:
    class: Drupal\package_manager\Validator\DiskSpaceValidator
    arguments:
      - '@package_manager.path_locator'
      - '@string_translation'
    tags:
      - { name: event_subscriber }
  package_manager.validator.pending_updates:
    class: Drupal\package_manager\Validator\PendingUpdatesValidator
    arguments:
      - '%app.root%'
      - '@update.post_update_registry'
      - '@string_translation'
    tags:
      - { name: event_subscriber }
  package_manager.validator.lock_file:
    class: Drupal\package_manager\Validator\LockFileValidator
    arguments:
      - '@state'
      - '@package_manager.path_locator'
      - '@string_translation'
    tags:
      - { name: event_subscriber }
  package_manager.validator.file_system:
    class: Drupal\package_manager\Validator\WritableFileSystemValidator
    arguments:
      - '@package_manager.path_locator'
      - '@string_translation'
    tags:
      - { name: event_subscriber }
  package_manager.validator.composer_settings:
    class: Drupal\package_manager\Validator\ComposerSettingsValidator
    arguments:
      - '@string_translation'
    tags:
      - { name: event_subscriber }
  package_manager.validator.multisite:
    class: Drupal\package_manager\Validator\MultisiteValidator
    arguments:
      - '@package_manager.path_locator'
      - '@string_translation'
    tags:
      - { name: event_subscriber }
  package_manager.validator.symlink:
    class: Drupal\package_manager\Validator\SymlinkValidator
    arguments:
      - '@module_handler'
      - '@package_manager.path_locator'
    tags:
      - { name: event_subscriber }
  package_manager.validator.duplicate_info_file:
    class: Drupal\package_manager\Validator\DuplicateInfoFileValidator
    arguments:
      - '@package_manager.path_locator'
    tags:
      - { name: event_subscriber }
  package_manager.test_site_excluder:
    class: Drupal\package_manager\PathExcluder\TestSiteExcluder
    arguments:
      - '@package_manager.path_locator'
    tags:
      - { name: event_subscriber }
  package_manager.vendor_hardening_excluder:
    class: Drupal\package_manager\PathExcluder\VendorHardeningExcluder
    arguments:
      - '@package_manager.path_locator'
    tags:
      - { name: event_subscriber }
  package_manager.site_files_excluder:
    class: Drupal\package_manager\PathExcluder\SiteFilesExcluder
    arguments:
      $path_locator: '@package_manager.path_locator'
      $stream_wrapper_manager: '@stream_wrapper_manager'
    tags:
      - { name: event_subscriber }
    autowire: true
  package_manager.sqlite_excluder:
    class: Drupal\package_manager\PathExcluder\SqliteDatabaseExcluder
    arguments:
      - '@package_manager.path_locator'
      - '@database'
    tags:
      - { name: event_subscriber }
  package_manager.git_excluder:
    class: Drupal\package_manager\PathExcluder\GitExcluder
    arguments:
      - '@package_manager.path_locator'
    tags:
      - { name: event_subscriber }
  package_manager.site_configuration_excluder:
    class: Drupal\package_manager\PathExcluder\SiteConfigurationExcluder
    arguments:
      - '%site.path%'
      - '@package_manager.path_locator'
    tags:
      - { name: event_subscriber }
  package_manager.uninstall_validator:
    class: Drupal\package_manager\PackageManagerUninstallValidator
    tags:
      - { name: module_install.uninstall_validator }
    parent: container.trait
    calls:
      - ['setContainer', ['@service_container']]
    lazy: true
  package_manager.validator.settings:
    class: Drupal\package_manager\Validator\SettingsValidator
    arguments:
      - '@string_translation'
    tags:
      - { name: event_subscriber }
  package_manager.validator.patches:
    class: Drupal\package_manager\Validator\ComposerPatchesValidator
    tags:
      - { name: event_subscriber }
  package_manager.update_processor:
    class: Drupal\package_manager\PackageManagerUpdateProcessor
    arguments: [ '@config.factory', '@queue', '@update.fetcher', '@state', '@private_key', '@keyvalue', '@keyvalue.expirable' ]
