import { dialog } from "electron";

export function showPrompt(
    content: string,
    type: "info" | "error" = "info",
    title: string = "提示",
) {
    dialog.showMessageBox({
        type: type,
        title: title,
        message: content,
        buttons: ["确定"],
    });
}

export function convertJobData(originalData: any) {
    // 检查输入是否为对象
    if (typeof originalData !== "object" || originalData === null) {
        console.error("输入必须是一个有效的对象。");
        return {};
    }

    const convertedData = {
        jobId: originalData.jobId,
        jobTitle: originalData.jobTitle,
        education: originalData.education,
        experience: originalData.experience,
        companyName: originalData.companyName,
        jobLocation: originalData.jobLocation,
        description: originalData.description,
        scale: originalData.scale,
    };

    return convertedData;
}

// async function jobTransformAIobj(job: any) {
//     // const val = await window.electron.ipcRenderer.invoke("ollama-test", job);
//     const val = await window.electron.ipcRenderer.invoke(
//         "run-job-workflow",
//         job,
//     );

//     if (val.success === false) {
//         throw new Error(val.error);
//     }
//     let record = {
//         ...job,
//         msg: val.data,
//     };
//     return record;
// }
