<commit_before>require "aaib_report_indexable_formatter"
require "builders/aaib_report_builder"
require "builders/cma_case_builder"
require "builders/drug_safety_update_builder"
require "builders/international_development_fund_builder"
require "builders/manual_builder"
require "builders/manual_document_builder"
require "builders/medical_safety_alert_builder"
require "cma_case_indexable_formatter"
require "dependency_container"
require "document_headers_depth_limiter"
require "drug_safety_update_indexable_formatter"
require "footnotes_section_heading_renderer"
require "gds_api/gov_uk_delivery"
require "gds_api/rummager"
require "gds_api_proxy"
require "id_generator"
require "manual_database_exporter"
require "marshallers/document_association_marshaller"
require "marshallers/manual_publish_task_association_marshaller"
require "medical_safety_alert_indexable_formatter"
require "null_finder_schema"
require "panopticon_registerer"
require "rendered_specialist_document"
require "rummager_indexer"
require "markdown_attachment_processor"
require "specialist_document_database_exporter"
require "govspeak_to_html_renderer"
require "specialist_document_header_extractor"
require "specialist_document_repository"
require "repository_registry"
require "entity_factory_registry"
require "validatable_entity_factory_registry"
require "view_adapter_registry"

$LOAD_PATH.unshift(File.expand_path("../..", "app/services"))

SpecialistPublisherWiring = DependencyContainer.new do
  define_factory(:manual_builder) {
    ManualBuilder.new(
      slug_generator: SlugGenerator.new(prefix: "guidance"),
      id_generator: IdGenerator,
      factory: get(:validatable_manual_with_sections_factory),
    )
  }

  define_factory(:validatable_manual_with_sections_factory) {
    ->(attrs) {
      ManualValidator.new(
        NullValidator.new(
          get(:manual_with_sections_factory).call(attrs),
        ),
      )
    }
  }

  define_factory(:manual_document_builder) {
    get(:validatable_entity_factories).manual_document_builder
  }

  define_factory(:manual_with_sections_factory) {
    ->(attrs) {
      ManualWithDocuments.new(
        get(:manual_document_builder),
        Manual.new(attrs),
        documents: [],
      )
    }
  }

  define_factory(:view_adapter_registry) {
    ViewAdapterRegistry.new
  }

  define_factory(:repository_registry) {
    RepositoryRegistry.new(
      entity_factories: get(:validatable_entity_factories),
    )
  }

  define_factory(:validatable_entity_factories) {
    ValidatableEntityFactoryRegistry.new(get(:entity_factories))
  }

  define_factory(:entity_factories) {
    EntityFactoryRegistry.new
  }

  define_singleton(:aaib_report_repository) do
    get(:repository_registry).aaib_report_repository
  end

  define_singleton(:cma_case_repository) do
    get(:repository_registry).cma_case_repository
  end

  define_singleton(:drug_safety_update_repository) do
    get(:repository_registry).drug_safety_update_repository
  end

  define_singleton(:medical_safety_alert_repository) do
    get(:repository_registry).medical_safety_alert_repository
  end

  define_singleton(:international_development_fund_repository) do
    get(:repository_registry).international_development_fund_repository
  end

  define_factory(:organisational_manual_repository_factory) {
    get(:repository_registry).method(:organisation_scoped_manual_repository)
  }

  define_singleton(:edition_factory) { SpecialistDocumentEdition.method(:new) }

  define_factory(:cma_case_builder) {
    CmaCaseBuilder.new(
      get(:validatable_entity_factories).cma_case_factory,
      IdGenerator,
    )
  }

  define_factory(:aaib_report_builder) {
    AaibReportBuilder.new(
      get(:validatable_entity_factories).aaib_report_factory,
      IdGenerator,
    )<commit_msg>Remove repositories from wiring<commit_after>require "aaib_report_indexable_formatter"
require "builders/aaib_report_builder"
require "builders/cma_case_builder"
require "builders/drug_safety_update_builder"
require "builders/international_development_fund_builder"
require "builders/manual_builder"
require "builders/manual_document_builder"
require "builders/medical_safety_alert_builder"
require "cma_case_indexable_formatter"
require "dependency_container"
require "document_headers_depth_limiter"
require "drug_safety_update_indexable_formatter"
require "footnotes_section_heading_renderer"
require "gds_api/gov_uk_delivery"
require "gds_api/rummager"
require "gds_api_proxy"
require "id_generator"
require "manual_database_exporter"
require "marshallers/document_association_marshaller"
require "marshallers/manual_publish_task_association_marshaller"
require "medical_safety_alert_indexable_formatter"
require "null_finder_schema"
require "panopticon_registerer"
require "rendered_specialist_document"
require "rummager_indexer"
require "markdown_attachment_processor"
require "specialist_document_database_exporter"
require "govspeak_to_html_renderer"
require "specialist_document_header_extractor"
require "specialist_document_repository"
require "repository_registry"
require "entity_factory_registry"
require "validatable_entity_factory_registry"
require "view_adapter_registry"

$LOAD_PATH.unshift(File.expand_path("../..", "app/services"))

SpecialistPublisherWiring = DependencyContainer.new do
  define_factory(:manual_builder) {
    ManualBuilder.new(
      slug_generator: SlugGenerator.new(prefix: "guidance"),
      id_generator: IdGenerator,
      factory: get(:validatable_manual_with_sections_factory),
    )
  }

  define_factory(:validatable_manual_with_sections_factory) {
    ->(attrs) {
      ManualValidator.new(
        NullValidator.new(
          get(:manual_with_sections_factory).call(attrs),
        ),
      )
    }
  }

  define_factory(:manual_document_builder) {
    get(:validatable_entity_factories).manual_document_builder
  }

  define_factory(:manual_with_sections_factory) {
    ->(attrs) {
      ManualWithDocuments.new(
        get(:manual_document_builder),
        Manual.new(attrs),
        documents: [],
      )
    }
  }

  define_factory(:view_adapter_registry) {
    ViewAdapterRegistry.new
  }

  define_factory(:repository_registry) {
    RepositoryRegistry.new(
      entity_factories: get(:validatable_entity_factories),
    )
  }

  define_factory(:validatable_entity_factories) {
    ValidatableEntityFactoryRegistry.new(get(:entity_factories))
  }

  define_factory(:entity_factories) {
    EntityFactoryRegistry.new
  }

  define_factory(:organisational_manual_repository_factory) {
    get(:repository_registry).method(:organisation_scoped_manual_repository)
  }

  define_singleton(:edition_factory) { SpecialistDocumentEdition.method(:new) }

  define_factory(:cma_case_builder) {
    CmaCaseBuilder.new(
      get(:validatable_entity_factories).cma_case_factory,
      IdGenerator,
    )
  }

  define_factory(:aaib_report_builder) {
    AaibReportBuilder.new(
      get(:validatable_entity_factories).aaib_report_factory,
      IdGenerator,
    )
{'fraction_non_alphanumeric': 0.08177536748965321, 'fraction_numerical': 0.0, 'mean_word_length': 6.361344537815126, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6255651', 'n_tokens_mistral': 2228, 'n_tokens_neox': 2122, 'n_words': 257}