export const actionKeyResolver = {
    type: "dynamic",
    depends: ["app", "actionType"],
    fetch: async (sdk, resolvedParams) => {
        const actionsResponse = await sdk.listActions({
            app: resolvedParams.app,
        });
        return actionsResponse.data.filter((action) => action.action_type === resolvedParams.actionType && !action.is_hidden);
    },
    prompt: (actions) => ({
        type: "list",
        name: "action",
        message: "Select action:",
        choices: actions.map((action) => ({
            name: action.title || action.name || action.key,
            hint: action.description || undefined,
            value: action.key,
        })),
    }),
};
