import request from "@/utils/request";

// 实验室列表
export function casLaboratoryList(params) {
    return request({
        url: "/business/casLaboratory/list",
        method: "GET",
        params,
    });
}

// 新增
export function casLaboratoryAdd(data) {
    return request({
        url: "/business/casLaboratory",
        method: "POST",
        data,
    });
}

// 修改
export function casLaboratoryUpdate(data) {
    return request({
        url: "/business/casLaboratory",
        method: "PUT",
        data,
    });
}

// id详情
export function casLaboratoryDetail(id) {
    return request({
        url: `/business/casLaboratory/${id}`,
        method: "GET",
    });
}

// 删除
export function casLaboratoryDelete(ids) {
    return request({
        url: `/business/casLaboratory`,
        method: "DELETE",
        data: {
            ids,
        },
    });
}

// 导入
export function casLaboratoryImportData(data) {
    return request({
        url: `/business/casLaboratory/importData`,
        method: "POST",
        data,
    });
}

// 实验室获取账号
export function getAccount(id) {
    return request({
        url: `/business/casLaboratory/getAccount/${id}`,
        method: "GET",
    });
}

// 实验室分配账号
export function allocateAccount(data) {
    return request({
        url: "/business/casLaboratory/allocateAccount",
        method: "post",
        data,
    });
}

// 实验室重置密码
export function restPassword(id, password) {
    return request({
        url: `/business/casLaboratory/restPassword/${id}/${password}`,
        method: "put",
    });
}


export const downloadLabTemplate = () => {
    return request({
        url: "/business/casLaboratory/importData",
        method: "get",
        responseType: "blob",
    })
}