import { toIterable } from "../utils/pagination-utils";
export const triggerInboxResolver = {
    type: "dynamic",
    fetch: async (sdk) => toIterable(sdk.listTriggerInboxes()),
    prompt: (inboxes) => ({
        type: "list",
        name: "inbox",
        message: "Select a trigger inbox:",
        // `deleting` inboxes are on their way out — no operation against them
        // is useful (delete is a no-op, pause/resume/update are rejected).
        choices: inboxes
            .filter((inbox) => inbox.status !== "deleting")
            .map((inbox) => ({
            name: inbox.name ?? inbox.id,
            hint: `${inbox.subscription.app_key} / ${inbox.subscription.action_key}, ${inbox.status}`,
            value: inbox.id,
        })),
    }),
};
