import { toIterable } from "../utils/pagination-utils";
export const triggerMessagesResolver = {
    type: "dynamic",
    depends: ["inbox"],
    fetch: async (sdk, params) => toIterable(sdk.listTriggerInboxMessages({
        inbox: params.inbox,
    })),
    prompt: (messages) => ({
        type: "checkbox",
        name: "messages",
        message: "Select messages:",
        // Only leased messages are eligible to ack or release. Acked messages
        // are gone from the inbox already; available/quarantined ones can't be
        // operated on by these methods.
        choices: messages
            .filter((message) => message.status === "leased")
            .map((message) => ({
            name: message.id,
            hint: `${message.status}, lease_count: ${message.message_attributes.lease_count}`,
            value: message.id,
        })),
    }),
};
