"""Public package entrypoint for the ECM sync engine."""

from __future__ import annotations

from importlib.metadata import PackageNotFoundError, version
from pathlib import Path
import sys

_PROJECT_ROOT = Path(__file__).resolve().parents[1]
if str(_PROJECT_ROOT) not in sys.path:
	sys.path.insert(0, str(_PROJECT_ROOT))

from . import domain as _domain
from .common.registry import DomainRegistry
from .config import (
	ApiDataSourceConfig,
	BaseDataSourceConfig,
	JsonlDataSourceConfig,
	PipelineRunConfig,
	build_config,
	build_config_from_file,
	build_default_config,
	get_datasource_config_model,
	get_datasource_factory,
	list_registered_datasource_types,
	load_named_preset_overrides,
	load_overrides_from_file,
	MultiProjectRunConfig,
	build_multi_project_config_from_file,
	is_multi_project_payload,
	register_datasource_config_model,
	register_datasource_factory,
	register_datasource_type,
)
from .datasource import ApiClient, ApiDataSource, BaseApiHandler, BaseJsonlHandler, JsonlDataSource
from .pipeline import FullSyncPipeline, MultiProjectPipeline, create_pipeline_from_config, run_pipeline_from_config, run_profile_from_file

try:
	__version__ = version("ecm-sync-system")
except PackageNotFoundError:
	__version__ = "0.1.0"


def ensure_domain_registry_loaded() -> None:
	"""Ensure built-in domain registrations are imported."""
	_ = _domain


__all__ = [
	"__version__",
	"ensure_domain_registry_loaded",
	"DomainRegistry",
	"PipelineRunConfig",
	"ApiDataSourceConfig",
	"BaseDataSourceConfig",
	"JsonlDataSourceConfig",
	"build_config",
	"build_config_from_file",
	"build_default_config",
	"get_datasource_config_model",
	"get_datasource_factory",
	"list_registered_datasource_types",
	"load_overrides_from_file",
	"load_named_preset_overrides",
	"MultiProjectRunConfig",
	"build_multi_project_config_from_file",
	"is_multi_project_payload",
	"register_datasource_config_model",
	"register_datasource_factory",
	"register_datasource_type",
	"ApiClient",
	"ApiDataSource",
	"JsonlDataSource",
	"BaseApiHandler",
	"BaseJsonlHandler",
	"FullSyncPipeline",
	"MultiProjectPipeline",
	"create_pipeline_from_config",
	"run_pipeline_from_config",
	"run_profile_from_file",
]
