"""Factory domain — the strategy-lifecycle population and its concepts."""
from fxhnt.domain.factory.models import (
    RegimeFit,
    StrategyRecord,
    StrategyStatus,
    strategy_id,
)


def candidate_key(market: str, kind: str, params: dict) -> str:
    """Canonical dedup key shared by every component that tests a (market, kind, params) hypothesis.

    Single authority: Proposal.key() and FleetOrchestrator's cand_key both delegate here so analyst
    proposals and hunt candidates live in the same dedup namespace — no cross-component double-count.

    Format: ``"market:kind:k1=v1,k2=v2"`` (params sorted, floats printed to 10 significant figures).
    """
    p = ",".join(f"{k}={float(v):.10g}" for k, v in sorted(params.items()))
    return f"{market}:{kind}:{p}"


__all__ = ["StrategyRecord", "StrategyStatus", "RegimeFit", "strategy_id", "candidate_key"]
