import request from "@/utils/request";
import { AxiosPromise } from "axios";

// 消息类型获取
export const messageType = () => {
    return request({
        url: "messageadmin/messageType/list",
        method: "post",
        // data: data,
    });
};

// 消息类型添加
export const addlabel = (data: any) => {
    return request({
        url: "messageadmin/messageType/add",
        method: "post",
        data: data,
    });
};
// 更新消息类型
export const updatalabel = (data: any) => {
    return request({
        url: "messageadmin/messageType/edit",
        method: "post",
        data: data,
    });
};

// 删除消息类型
export const removeType = (data: any) => {
    return request({
        url: `messageadmin/messageType/del/${data}`,
        method: "post",
    });
};

// 获取群聊列表
export const messageAllsendList = (data: any) => {
    return request({
        url: "messageadmin/messageAllsend/list",
        method: "post",
        data: data,
    });
};

// 新建群聊
export const addMessageAllsend = (data: any, sendNow: Boolean) => {
    console.log(data, sendNow);
    return request({
        url: "messageadmin/messageAllsend/sendAll?sendNow=" + sendNow,
        method: "post",
        data: data,
    });
};

// 修改群聊信息
export const messageAllsendUpdate = (data: any) => {
    return request({
        url: "messageadmin/messageAllsend/update",
        method: "post",
        data: data,
    });
};

// 删除群聊信息
export const messageAllsendDel = (data: any) => {
    return request({
        url: "messageadmin/messageAllsend/del",
        method: "post",
        params: data,
    });
};

// 获取群聊详情列表
export const messageDetailList = (data: any) => {
    return request({
        url: "messageadmin/messageDetail/list",
        method: "post",
        data: data,
    });
};

// 修改群聊详情列表
export const messageDetailUpdata = (data: any) => {
    return request({
        url: "messageadmin/messageDetail/update",
        method: "post",
        data: data,
    });
};

// 删除群聊详情列表
export const messageDetailDel = (data: any) => {
    return request({
        url: "messageadmin/messageDetail/del",
        method: "post",
        params: data,
    });
};

// 邮箱验证码列表
export const emailCodeList = (data: any) => {
    return request({
        url: "admin/email-code/list",
        method: "post",
        params: data,
    });
};

// 发送邮件
export const sendEmail = (data: { memberId: number; subject: string; content: string }) => {
    return request({
        url: "admin/member/send-email",
        method: "post",
        params: data,
    });
};

// 邮件发送记录列表
export const emailSendRecordList = (data: any) => {
    return request({
        url: "admin/member/email-send-record/list",
        method: "post",
        params: data,
    });
};
