import type { KaijiBotConfig } from "../../config/config.js";
import type { DmPolicy } from "../../config/types.js";
import type { RuntimeEnv } from "../../runtime.js";
import type { WizardPrompter } from "../../wizard/prompts.js";
import type { ChannelId, ChannelPlugin } from "./types.js";
export type ChannelSetupPlugin = Pick<ChannelPlugin, "id" | "meta" | "capabilities" | "config" | "setup" | "setupWizard">;
export type SetupChannelsOptions = {
    allowDisable?: boolean;
    allowSignalInstall?: boolean;
    onSelection?: (selection: ChannelId[]) => void;
    onPostWriteHook?: (hook: ChannelOnboardingPostWriteHook) => void;
    accountIds?: Partial<Record<ChannelId, string>>;
    onAccountId?: (channel: ChannelId, accountId: string) => void;
    onResolvedPlugin?: (channel: ChannelId, plugin: ChannelSetupPlugin) => void;
    promptAccountIds?: boolean;
    forceAllowFromChannels?: ChannelId[];
    skipStatusNote?: boolean;
    skipDmPolicyPrompt?: boolean;
    skipConfirm?: boolean;
    quickstartDefaults?: boolean;
    initialSelection?: ChannelId[];
    secretInputMode?: "plaintext" | "ref";
};
export type PromptAccountIdParams = {
    cfg: KaijiBotConfig;
    prompter: WizardPrompter;
    label: string;
    currentId?: string;
    listAccountIds: (cfg: KaijiBotConfig) => string[];
    defaultAccountId: string;
};
export type PromptAccountId = (params: PromptAccountIdParams) => Promise<string>;
export type ChannelSetupStatus = {
    channel: ChannelId;
    configured: boolean;
    statusLines: string[];
    selectionHint?: string;
    quickstartScore?: number;
};
export type ChannelSetupStatusContext = {
    cfg: KaijiBotConfig;
    options?: SetupChannelsOptions;
    accountOverrides: Partial<Record<ChannelId, string>>;
};
export type ChannelSetupConfigureContext = {
    cfg: KaijiBotConfig;
    runtime: RuntimeEnv;
    prompter: WizardPrompter;
    options?: SetupChannelsOptions;
    accountOverrides: Partial<Record<ChannelId, string>>;
    shouldPromptAccountIds: boolean;
    forceAllowFrom: boolean;
};
export type ChannelOnboardingPostWriteContext = {
    previousCfg: KaijiBotConfig;
    cfg: KaijiBotConfig;
    accountId: string;
    runtime: RuntimeEnv;
};
export type ChannelOnboardingPostWriteHook = {
    channel: ChannelId;
    accountId: string;
    run: (ctx: {
        cfg: KaijiBotConfig;
        runtime: RuntimeEnv;
    }) => Promise<void> | void;
};
export type ChannelSetupResult = {
    cfg: KaijiBotConfig;
    accountId?: string;
};
export type ChannelSetupConfiguredResult = ChannelSetupResult | "skip";
export type ChannelSetupInteractiveContext = ChannelSetupConfigureContext & {
    configured: boolean;
    label: string;
};
export type ChannelSetupDmPolicy = {
    label: string;
    channel: ChannelId;
    policyKey: string;
    allowFromKey: string;
    resolveConfigKeys?: (cfg: KaijiBotConfig, accountId?: string) => {
        policyKey: string;
        allowFromKey: string;
    };
    getCurrent: (cfg: KaijiBotConfig, accountId?: string) => DmPolicy;
    setPolicy: (cfg: KaijiBotConfig, policy: DmPolicy, accountId?: string) => KaijiBotConfig;
    promptAllowFrom?: (params: {
        cfg: KaijiBotConfig;
        prompter: WizardPrompter;
        accountId?: string;
    }) => Promise<KaijiBotConfig>;
};
export type ChannelSetupWizardAdapter = {
    channel: ChannelId;
    getStatus: (ctx: ChannelSetupStatusContext) => Promise<ChannelSetupStatus>;
    configure: (ctx: ChannelSetupConfigureContext) => Promise<ChannelSetupResult>;
    configureInteractive?: (ctx: ChannelSetupInteractiveContext) => Promise<ChannelSetupConfiguredResult>;
    configureWhenConfigured?: (ctx: ChannelSetupInteractiveContext) => Promise<ChannelSetupConfiguredResult>;
    afterConfigWritten?: (ctx: ChannelOnboardingPostWriteContext) => Promise<void> | void;
    dmPolicy?: ChannelSetupDmPolicy;
    onAccountRecorded?: (accountId: string, options?: SetupChannelsOptions) => void;
    disable?: (cfg: KaijiBotConfig) => KaijiBotConfig;
};
