import request from "@/utils/request";

// 公司企业列表
export function companyList(params) {
    return request({
        url: "/business/enterprise/list",
        method: "get",
        params,
    });
}

// 公司企业信息添加
export function companyAdd(data) {
    return request({
        url: "/business/enterprise",
        method: "post",
        data,
    });
}

// 公司企业信息删除
export function companyDelete(ids) {
    return request({
        url: `/business/enterprise/${ids}`,
        method: "delete",
    });
}

// 公司企业详细信息
export function companyDetail(id) {
    return request({
        url: `/business/enterprise/${id}`,
        method: "get",
    });
}

// 公司企业信息修改
export function companyEdit(data) {
    return request({
        url: "/business/enterprise",
        method: "put",
        data,
    });
}

export const companyExport = () => {
    return request({
        url: "/business/enterprise/export",
        method: "get",
    });
};

// 公司企业分配账号
export function allocateAccount(data) {
    return request({
        url: "/business/enterprise/allocateAccount",
        method: "post",
        data,
    });
}

// 公司企业获取账号
export function getAccount(id) {
    return request({
        url: `/business/enterprise/getAccount/${id}`,
        method: "get",
    });
}

// 公司企业重置密码
export function restPassword(id, password) {
    return request({
        url: `/business/enterprise/restPassword/${id}/${password}`,
        method: "put",
    });
}

// 公司企业获取会员详情
export function getCasVip(id) {
    return request({
        url: `/business/casVip/${id}`,
        method: "get",
    });
}

// 公司企业开通会员详情
export function openCasVip(data) {
    return request({
        url: `/business/casVip`,
        method: "post",
        data,
    });
}

// 公司企业修改会员
export function updateCasVip(data) {
    return request({
        url: `/business/casVip`,
        method: "put",
        data,
    });
}


export const downloadEnterpriseTemplate = () => {
    return request({
        url: "/business/enterprise/importTemplate",
        method: "get",
        responseType: "blob",
    });
}