import { requestJson } from "@insite/shell/Services/ServiceBase";

export const importContent = (file: File) => {
    const formData = new FormData();
    formData.append("file", file);
    return requestJson<{ success: boolean; errorMessage: string; jobId: string }>(
        "/admin/websites/importSpireContent",
        "POST",
        {},
        formData,
    );
};

export const checkImportContentStatus = (jobId: string) => {
    return requestJson<{ isFinished: boolean; errorMessage: string }>(
        `/admin/websites/checkImportSpireContentStatus?jobId=${jobId}`,
        "POST",
    );
};

export const restoreContent = () =>
    requestJson<{ success: boolean; errorMessage: string }>("/admin/websites/restoreSpireContent", "POST");
