services:
  #####################################################################################################################
  # Some services are commented out due to a bug in the Drupal DI (https://www.drupal.org/project/drupal/issues/2828099)
  # Drupal 9.3 will use the Symfony DI directly meaning we'll be able to use this yaml more extensively
  # and autowiring will be supported (https://www.drupal.org/project/drupal/issues/3111008)
  #####################################################################################################################

  languagewire.drupal.system:
    class: Drupal\languagewire_translation_provider\Adapter\System
    arguments: [
      '@languagewire.configuration_item_repository',
      '@languagewire.project_template_repository',
      '@extension.list.module',
      '@file_system',
    ]

  # Repositories and their dependent sub-services
  languagewire.entity_repository:
    class: Drupal\languagewire_translation_provider\Adapter\Entity\EntityRepository
    arguments: [
      '@languagewire.drupal.system',
      '@entity_type.manager'
    ]
  languagewire.configuration_item_repository:
    class: Drupal\languagewire_translation_provider\Adapter\Database\ConfigurationItemRepository
    arguments: ['@database']
  languagewire.document_repository:
    class: Drupal\languagewire_translation_provider\Adapter\Database\DocumentRepository
    arguments: [
      '@database',
      '@languagewire.document_mapper'
    ]
  languagewire.project_repository:
    class: Drupal\languagewire_translation_provider\Adapter\Database\ProjectRepository
    arguments: [
      '@database',
      '@languagewire.project_mapper',
      '@languagewire.document_repository'
    ]
  languagewire.project_template_repository:
    class: Drupal\languagewire_translation_provider\Adapter\Database\ProjectTemplateRepository
    arguments: [
      '@database',
      '@languagewire.project_template_mapper'
    ]
  languagewire.project_mapper:
    class: Drupal\languagewire_translation_provider\Database\Mapper\ProjectMapper
    arguments: [
      '@languagewire.tmgmt_job_repository',
      '@languagewire.document_repository'
    ]
  languagewire.project_template_mapper:
    class: Drupal\languagewire_translation_provider\Database\Mapper\ProjectTemplateMapper
  languagewire.document_mapper:
    class: Drupal\languagewire_translation_provider\Database\Mapper\DocumentMapper
    arguments: ['@languagewire.tmgmt_job_item_repository']
  languagewire.tmgmt_job_repository:
    class: Drupal\languagewire_translation_provider\Adapter\TMGMT\TmgmtJobRepository
  languagewire.tmgmt_job_item_repository:
    class: Drupal\languagewire_translation_provider\Adapter\TMGMT\TmgmtJobItemRepository
  languagewire.tmgmt_translator_repository:
    class: Drupal\languagewire_translation_provider\Adapter\TMGMT\TmgmtTranslatorRepository
    arguments: ['@entity_type.manager']
  languagewire.project_specification_factory:
    class: Drupal\languagewire_translation_provider\Client\ProjectSpecificationFactory
    arguments: ['@languagewire.project_template_repository']
  languagewire.configuration_item_importer_factory:
    class: Drupal\languagewire_translation_provider\Platform\ConfigurationItemImporterFactory
    arguments: [
      '@languagewire.drupal.system',
      '@languagewire.project_specification_factory'
    ]
  languagewire.job_info_ui:
    class: Drupal\languagewire_translation_provider\Ui\JobInfoUi
    arguments: [
      '@module_handler',
      '@languagewire.project_repository'
    ]
  languagewire.configuration_form_ui:
    class: Drupal\languagewire_translation_provider\Ui\ConfigurationFormUi
    arguments: [
      '@languagewire.drupal.system',
      '@languagewire.project_template_repository',
      '@languagewire.html_preview_settings_checker',
      '@renderer'
    ]
  languagewire.checkout_ui:
    class: Drupal\languagewire_translation_provider\Ui\CheckoutUi
    arguments: [
      '@languagewire.drupal.system',
      '@languagewire.template_or_service_form',
      '@date.formatter'
    ]
  languagewire.template_or_service_form:
    class: Drupal\languagewire_translation_provider\Ui\CheckoutUi\TemplateOrServiceForm
    arguments: [
      '@languagewire.drupal.system',
      '@languagewire.configuration_item_repository'
    ]
  languagewire.project_state_handler:
    class: Drupal\languagewire_translation_provider\Service\ProjectStateHandler
    arguments: ['@languagewire.project_repository']
  languagewire.project_manager:
    class: Drupal\languagewire_translation_provider\Domain\ProjectManager
    arguments: [
      '@languagewire.project_repository',
      '@languagewire.document_repository'
    ]

  # HTML Preview

  languagewire.html_preview_service:
    class: Drupal\languagewire_translation_provider\Service\HtmlPreviewService
    arguments: [
      '@languagewire.html_preview_generator',
      '@languagewire.html_preview_package_creator',
      '@languagewire.html_preview_settings_checker',
      '@languagewire.html_preview_temporary_artifacts_cleaner',
      '@languagewire.entity_repository',
      '@languagewire.drupal.system'
    ]
  languagewire.preview_site_index_file_mover:
    class: Drupal\languagewire_translation_provider\Adapter\PreviewSite\CleanupAction\PreviewSiteIndexFileMover
  languagewire.preview_site_url_fixer:
    class: Drupal\languagewire_translation_provider\Adapter\PreviewSite\CleanupAction\PreviewSiteUrlFixer
    arguments: ['@languagewire.preview_site_url_processor']
  languagewire.preview_site_cleanup_action:
    class: Drupal\languagewire_translation_provider\Adapter\PreviewSite\CleanupAction\PreviewSiteCompositeCleanupAction
    arguments: [
      '@languagewire.preview_site_index_file_mover',
      '@languagewire.preview_site_url_fixer'
    ]
  languagewire.html_preview_generator:
    class: Drupal\languagewire_translation_provider\Adapter\PreviewSite\PreviewSiteHtmlPreviewGenerator
    arguments: [
      '@languagewire.preview_site_build_factory',
      '@languagewire.preview_site_builder',
      '@languagewire.preview_site_build_repository',
      '@languagewire.preview_strategy_repository',
      '@languagewire.preview_site_cleanup_action',
      '@languagewire.drupal.system'
    ]
  languagewire.html_preview_package_creator:
    class: Drupal\languagewire_translation_provider\Content\HtmlPreview\HtmlPreviewPackageCreator
    arguments: ['@languagewire.drupal.system']
  languagewire.html_preview_temporary_artifacts_cleaner:
    class: Drupal\languagewire_translation_provider\Content\HtmlPreview\HtmlPreviewTemporaryArtifactsCleaner
    arguments: ['@languagewire.drupal.system']
  languagewire.html_preview_settings_checker:
    class: Drupal\languagewire_translation_provider\Content\HtmlPreview\HtmlPreviewSettingsChecker
    arguments: ['@languagewire.drupal.system']
  languagewire.preview_site_url_processor:
    class: Drupal\languagewire_translation_provider\Content\HtmlPreview\HtmlPreviewUrlProcessor
  languagewire.preview_site_build_factory:
    class: Drupal\languagewire_translation_provider\Adapter\PreviewSite\PreviewSiteBuildFactory
    arguments: [
      '@languagewire.preview_site_build_repository',
      '@languagewire.preview_strategy_repository'
    ]
  languagewire.preview_site_builder:
    class: Drupal\languagewire_translation_provider\Adapter\PreviewSite\PreviewSiteBuilder
  languagewire.preview_site_build_repository:
    class: Drupal\languagewire_translation_provider\Adapter\PreviewSite\PreviewSiteBuildRepository
  languagewire.preview_strategy_repository:
    class: Drupal\languagewire_translation_provider\Adapter\PreviewSite\PreviewStrategyRepository
