<?php
declare(strict_types=1);
// @responsibility: Register Content bounded context services in DI container
namespace ServiceProvider;
use Application\ContentCollectionService;
use Application\PipelineStepService;
use Domain\Repository\ChunkRepositoryInterface;
use Domain\Repository\CollectionRepositoryInterface;
use Domain\Repository\ContentRepositoryInterface;
use Domain\Repository\DocumentRepositoryInterface;
use Domain\Repository\EntityRepositoryInterface;
use Domain\Repository\OntologyRepositoryInterface;
use Domain\Repository\PipelineConfigRepositoryInterface;
use Domain\Repository\PipelineRepositoryInterface;
use Domain\Repository\PipelineRunRepositoryInterface;
use Domain\Repository\PipelineStepRepositoryInterface;
use Domain\Repository\RelationRepositoryInterface;
use Domain\Repository\SemanticSearchRepositoryInterface;
use Domain\Repository\TaxonomyRepositoryInterface;
use Framework\Container;
use Infrastructure\Docs\ChunkAnalysisService;
use Infrastructure\Docs\ChunkingService;
use Infrastructure\Docs\ChunkSearchService;
use Infrastructure\Docs\ChunkSyncService;
use Infrastructure\Docs\HybridSearchService;
use Infrastructure\Persistence\ChunkRepository;
use Infrastructure\Persistence\CollectionRepository;
use Infrastructure\Persistence\ContentRepository;
use Infrastructure\Persistence\DocumentRepository;
use Infrastructure\Persistence\EntityRepository;
use Infrastructure\Persistence\OntologyRepository;
use Infrastructure\Persistence\PipelineRepository;
use Infrastructure\Persistence\RelationRepository;
use Infrastructure\Persistence\SemanticSearchRepository;
use Infrastructure\Persistence\TaxonomyRepository;
use Infrastructure\Validation\CollectionValidator;
/**
* ContentServiceProvider registers all content management services.
*/
final class ContentServiceProvider implements ServiceProviderInterface
{
public function register(Container $container): void
{
// Repositories
$container->set(CollectionRepository::class, fn (Container $c) => new CollectionRepository($c->get('pdo.dev'), $c->get('pdo.content')));
$container->set(PipelineRepository::class, fn (Container $c) => new PipelineRepository($c->get('pdo.content')));
$container->set(ContentRepository::class, fn (Container $c) => new ContentRepository($c->get('pdo.content')));
$container->set(TaxonomyRepository::class, fn (Container $c) => new TaxonomyRepository($c->get('pdo.content')));
$container->set(OntologyRepository::class, fn (Container $c) => new OntologyRepository($c->get('pdo.content')));
$container->set(DocumentRepository::class, fn (Container $c) => new DocumentRepository($c->get('pdo.content')));
$container->set(ChunkRepository::class, fn (Container $c) => new ChunkRepository($c->get('pdo.content')));
$container->set(RelationRepository::class, fn (Container $c) => new RelationRepository($c->get('pdo.content')));
$container->set(EntityRepository::class, fn (Container $c) => new EntityRepository($c->get('pdo.content')));
$container->set(SemanticSearchRepository::class, fn (Container $c) => new SemanticSearchRepository($c->get('pdo.content')));
// Interface aliases
$container->set(CollectionRepositoryInterface::class, fn (Container $c) => $c->get(CollectionRepository::class));
$container->set(PipelineRepositoryInterface::class, fn (Container $c) => $c->get(PipelineRepository::class));
$container->set(ContentRepositoryInterface::class, fn (Container $c) => $c->get(ContentRepository::class));
$container->set(TaxonomyRepositoryInterface::class, fn (Container $c) => $c->get(TaxonomyRepository::class));
$container->set(OntologyRepositoryInterface::class, fn (Container $c) => $c->get(OntologyRepository::class));
$container->set(DocumentRepositoryInterface::class, fn (Container $c) => $c->get(DocumentRepository::class));
$container->set(ChunkRepositoryInterface::class, fn (Container $c) => $c->get(ChunkRepository::class));
$container->set(RelationRepositoryInterface::class, fn (Container $c) => $c->get(RelationRepository::class));
$container->set(EntityRepositoryInterface::class, fn (Container $c) => $c->get(EntityRepository::class));
$container->set(SemanticSearchRepositoryInterface::class, fn (Container $c) => $c->get(SemanticSearchRepository::class));
// Services
$container->set(CollectionValidator::class, function (Container $c) {
return new CollectionValidator($c->get(CollectionRepository::class));
});
$container->set(ContentCollectionService::class, function (Container $c) {
return new ContentCollectionService(
$c->get(CollectionRepository::class),
$c->get(CollectionValidator::class)
);
});
$container->set(PipelineStepService::class, function (Container $c) {
return new PipelineStepService(
$c->get(PipelineRepository::class),
$c->get(\Infrastructure\AI\ModelRegistry::class)
);
});
}
}