"""DataTools deduplication engine.

Public API
----------
Core:
    deduplicate(df, ...) -> DeduplicationResult
    build_default_strategies(df) -> list[MatchStrategy]

Types:
    Algorithm, SurvivorRule, ColumnMatchStrategy, MatchStrategy
    MatchResult, DeduplicationResult

Normalizers:
    get_normalizer(type) -> Callable
    NormalizerType
    normalize_email, normalize_phone, normalize_name,
    normalize_address, normalize_string

I/O:
    read_file(path, ...) -> DataFrame
    write_file(df, path, ...)
    list_sheets(path) -> list[str]
    detect_encoding, detect_delimiter, detect_header_row

Configuration:
    DeduplicationConfig.from_file(path) -> DeduplicationConfig
    DeduplicationConfig.to_file(path)
"""

from .dedup import (
    Algorithm,
    ColumnMatchStrategy,
    DeduplicationResult,
    MatchResult,
    MatchStrategy,
    SurvivorRule,
    build_default_strategies,
    deduplicate,
)
from .normalizers import (
    NormalizerType,
    get_normalizer,
    normalize_address,
    normalize_email,
    normalize_name,
    normalize_phone,
    normalize_string,
)
from .io import (
    detect_delimiter,
    detect_encoding,
    detect_header_row,
    list_sheets,
    read_csv_repaired,
    read_file,
    repair_bytes,
    write_file,
    RepairAction,
    RepairResult,
)
from .analyze import (
    Finding,
    analyze,
    findings_by_tool,
    to_dict,
)
from .config import (
    ColumnStrategyConfig,
    DeduplicationConfig,
    StrategyConfig,
)
from .text_clean import (
    CleanOptions,
    CleanResult,
    PRESETS,
    apply_case,
    clean_dataframe,
    clean_value,
    collapse_whitespace,
    fold_smart_chars,
    hidden_char_css,
    normalize_line_endings,
    sentence_case,
    smart_title_case,
    strip_bom,
    strip_control,
    strip_zero_width,
    to_nfc,
    to_nfkc,
    trim,
    visualize_hidden_html,
    visualize_hidden_text,
)
from .format_standardize import (
    FieldType,
    PRESETS as STANDARDIZE_PRESETS,
    StandardizeOptions,
    StandardizeResult,
    StreamingStandardizeResult,
    detect_currency_code,
    standardize_address,
    standardize_boolean,
    standardize_currency,
    standardize_dataframe,
    standardize_date,
    standardize_file,
    standardize_name,
    standardize_phone,
)
from .missing import (
    DEFAULT_SENTINELS,
    ColumnReport,
    MissingOptions,
    MissingProfile,
    MissingResult,
    PRESETS as MISSING_PRESETS,
    Strategy as MissingStrategy,
    detect_sentinels,
    handle_missing,
    is_missing_like,
    profile_missing,
)
from .column_mapper import (
    ColumnDtype,
    MapOptions,
    MapResult,
    PRESETS as MAP_PRESETS,
    TargetField,
    TargetSchema,
    UnmappedStrategy,
    coerce_series,
    infer_mapping,
    map_columns,
)
from .pipeline import (
    Pipeline,
    PipelineResult,
    SOFT_DEPENDENCIES,
    Step,
    StepResult,
    TOOL_ADAPTERS,
    TOOL_NAMES,
    recommended_pipeline,
    run_pipeline,
    validate_pipeline,
)

__all__ = [
    # Core
    "deduplicate",
    "build_default_strategies",
    # Types
    "Algorithm",
    "SurvivorRule",
    "ColumnMatchStrategy",
    "MatchStrategy",
    "MatchResult",
    "DeduplicationResult",
    # Normalizers
    "NormalizerType",
    "get_normalizer",
    "normalize_email",
    "normalize_phone",
    "normalize_name",
    "normalize_address",
    "normalize_string",
    # I/O
    "read_file",
    "write_file",
    "list_sheets",
    "detect_encoding",
    "detect_delimiter",
    "detect_header_row",
    "read_csv_repaired",
    "repair_bytes",
    "RepairAction",
    "RepairResult",
    # Analyzer
    "Finding",
    "analyze",
    "findings_by_tool",
    "to_dict",
    # Config
    "DeduplicationConfig",
    "StrategyConfig",
    "ColumnStrategyConfig",
    # Text cleaning
    "CleanOptions",
    "CleanResult",
    "PRESETS",
    "clean_dataframe",
    "clean_value",
    "trim",
    "collapse_whitespace",
    "to_nfc",
    "to_nfkc",
    "fold_smart_chars",
    "strip_zero_width",
    "strip_bom",
    "strip_control",
    "normalize_line_endings",
    "smart_title_case",
    "sentence_case",
    "apply_case",
    "visualize_hidden_text",
    "visualize_hidden_html",
    "hidden_char_css",
    # Format standardization
    "FieldType",
    "STANDARDIZE_PRESETS",
    "StandardizeOptions",
    "StandardizeResult",
    "StreamingStandardizeResult",
    "detect_currency_code",
    "standardize_dataframe",
    "standardize_date",
    "standardize_phone",
    "standardize_currency",
    "standardize_name",
    "standardize_address",
    "standardize_boolean",
    "standardize_file",
    # Missing-value handling
    "DEFAULT_SENTINELS",
    "ColumnReport",
    "MissingOptions",
    "MissingProfile",
    "MissingResult",
    "MISSING_PRESETS",
    "MissingStrategy",
    "detect_sentinels",
    "handle_missing",
    "is_missing_like",
    "profile_missing",
    # Column mapping
    "ColumnDtype",
    "MapOptions",
    "MapResult",
    "MAP_PRESETS",
    "TargetField",
    "TargetSchema",
    "UnmappedStrategy",
    "coerce_series",
    "infer_mapping",
    "map_columns",
    # Pipeline
    "Pipeline",
    "PipelineResult",
    "SOFT_DEPENDENCIES",
    "Step",
    "StepResult",
    "TOOL_ADAPTERS",
    "TOOL_NAMES",
    "recommended_pipeline",
    "run_pipeline",
    "validate_pipeline",
]
