export const tableFieldIdsResolver = {
    type: "dynamic",
    depends: ["table"],
    fetch: (sdk, params) => {
        return sdk.listTableFields({ table: params.table });
    },
    prompt: (fields) => ({
        type: "checkbox",
        name: "fields",
        message: "Select fields:",
        choices: fields.map((field) => ({
            name: field.name,
            hint: [field.id, field.type],
            value: field.id,
        })),
        validate: (value) => Array.isArray(value) && value.length > 0
            ? true
            : "Select at least one field",
    }),
};
