"""Flow registry.

Each flow is a `run(sb, params, cfg) -> dict` function. Result shape:

    { "ok": bool, "log": str | None, "error": str | None,
      "email": str | None, "password": str | None, "save_as_site": str | None }

The ack endpoint reads email/password/save_as_site to persist to the vault
automatically. Flows that save their own credentials (the full flow does this
immediately after signup) should still surface email/password so the final
ack's side-effects remain idempotent.
"""
from typing import Any, Callable, Dict

from . import full_flow, smurfmarkt, spotify_signup, trikatuka

RUNNERS: Dict[str, Callable[..., Dict[str, Any]]] = {
    "ext_spotify_signup": spotify_signup.run_standalone,
    "ext_trikatuka_transfer": trikatuka.run_standalone,
    "ext_smurfmarkt_upgrade": smurfmarkt.run_standalone,
    "ext_full_flow": full_flow.run,
}


def get(command_type: str):
    return RUNNERS.get(command_type)
