import microwaveRequest from "@/lib/request-microwave";
import realityRequest from "@/lib/request-reality";
import fileRequest from "@/lib/request-file";

// 真实性校验方法
export function checkReality(data) {
    return realityRequest({
        url: "check/reality",
        method: "post",
        headers: { "Content-Type": "multipart/form-data" },
        data
    });
}

export function checkTest(data) {
    return realityRequest({
        url: "check/my",
        method: "post",
        headers: { "Content-Type": "multipart/form-data" },
        data
    });
}

// 获取元数据信息
export function getProductMetaMsg(data) {
    return realityRequest({
        url: "common/getMetadataInfo",
        method: "post",
        data
    });
}
// 获取待检验产品订单列表
export function getPendingList(data) {
    return microwaveRequest({
        url: "validationOrder/getPendingList",
        method: "post",
        headers: { "Content-Type": "multipart/form-data" },
        data
    });
}

//更新订单信息
export function updateOrderMsg(data) {
    return microwaveRequest({
        url: "validationOrder/update",
        method: "post",
        data
    });
}
// 获取订单信息
export function getProductMsg(data) {
    return microwaveRequest({
        url: "validationOrder/getOrderMsg",
        method: "post",
        data
    });
}

//更新订单编辑状态
export function updateOrderStatus(orderId) {
    return microwaveRequest({
        url: "/validationOrder/updateTime?id=" + orderId,
        method: "get"
    });
}

//更新订单编辑状态
export function disOrderStatus(orderId) {
    return microwaveRequest({
        url: "/validationOrder/updateByIdTimeNull?id=" + orderId,
        method: "get"
    });
}

// 根据抽样算法获取抽样后样本数据
export function getSampleData(data) {
    return realityRequest({
        url: "sampleGet/getSampleData",
        method: "post",
        headers: { "Content-Type": "multipart/form-data" },
        data
    });
}

// 分层抽样获取样本数据
export function getSamplesByLayer(data) {
    return realityRequest({
        url: "sampleGet/getSamplesByLayer",
        method: "post",
        headers: { "Content-Type": "multipart/form-data" },
        data
    });
}

// 获取订单关联的所有样本数据
export function getOrderSamples(orderId, productType) {
    return microwaveRequest({
        url: "metaDataOrder/getOrderSamples?orderId=" + orderId + "&productType=" + productType,
        method: "post"
    });
}
// 根据样本ID删除订单样本数据
export function deleteOrderSamplesByID(sampleId, productType) {
    return microwaveRequest({
        url:
            "metaDataOrder/deleteOrderSamplesByID?sampleId=" +
            sampleId +
            "&productType=" +
            productType,
        method: "post"
    });
}
// 抽样后样本数据入库
export function addConnectSamples(data) {
    return microwaveRequest({
        url: "metaDataOrder/updateConnectSamples",
        method: "post",
        headers: { "Content-Type": "multipart/form-data" },
        data
    });
}
// 查询订单关联的地物映射关系
export function getCoverTypes(orderId) {
    return microwaveRequest({
        url: "landCoverType/getCoverType?orderId=" + orderId,
        method: "post"
    });
}

// 地表覆盖类型与空基类型关联
export function updateFeature(data) {
    return microwaveRequest({
        url: "landCoverType/updateCoverType",
        method: "post",
        headers: { "Content-Type": "multipart/form-data" },
        data
    });
}

// 订单反馈
export function orderFeedback(data) {
    return microwaveRequest({
        url: "ordersFeedback/orderFeedback",
        method: "post",
        headers: { "Content-Type": "multipart/form-data" },
        data
    });
}

// 订单状态更新
export function updateOrderStage(data) {
    return microwaveRequest({
        url: "orderStatus/updateOrderStage",
        method: "post",
        headers: { "Content-Type": "multipart/form-data" },
        data
    });
}

// 导出pdf模板
export function exportWord(data, pdfName, localTiffPath, httpTiffPath, productType) {
    return fileRequest({
        url:
            "importPDF/importWordAndPDF?reportName=" +
            pdfName +
            "&localTiffPath=" +
            localTiffPath +
            "&httpTiffPath=" +
            httpTiffPath +
            "&productType=" +
            productType,
        method: "post",
        // headers:{'Content-Type':'multipart/form-data'},
        data
    });
}

//下载PDF报告
export function downloadPdf(url) {
    return microwaveRequest({
        url: url,
        responseType: "blob",
        method: "GET"
    });
}

// 添加报告信息
export function addReportMsg(data) {
    return microwaveRequest({
        url: "validationReport/addReportMsg",
        headers: { "Content-Type": "multipart/form-data" },
        method: "post",
        data
    });
}
// 查询报告信息
export function getReportMsg(orderId) {
    return microwaveRequest({
        url: "validationReport/getReportMsg?orderId=" + orderId,
        method: "get"
    });
}

//获取订单处理失败的信息
export function getFeedbackMsg(orderId) {
    return microwaveRequest({
        url: "ordersFeedback/getFeedbackMsg?orderId=" + orderId,
        method: "get"
    });
}
