import request from "@/utils/request";


export interface GetChatMessageListProps {
    "pageNum": number,
    "pageSize": number
    "corpId"?: string,
    "corpUserId"?: string,
    "chatType"?: 1 | 2,
    "messageContent"?: string,
    "messageTimeEnd"?: string,
    "messageTimeStart"?: string,
    chatName?: string
    senderName?: string
    riskLevel?: number
    msgType?: string[]
}

/**
 * 获取聊天记录列表
 * @param data 
 * @returns 
 */
export async function getChatMessageListApi(data: GetChatMessageListProps) {
    return request({
        url: `/chat/message/list`,
        method: 'POST',
        data
    });
}

export interface KeywordProps {
    "corpId": string,
    "corpUserId": string,
    "keywordJson": string[],
    "riskLevel": 1 | 2 | 3,
    "id"?: number
}

/**
 * 创建风险词
 * @param data 
 * @returns 
 */
export async function createKeywordApi(data: KeywordProps) {
    return request({
        url: `/chat/message/keyword/create`,
        method: 'POST',
        data
    });
}


/**
 * 修改风险词
 * @param data 
 * @returns 
 */
export async function updateKeywordApi(data: KeywordProps) {
    return request({
        url: `/chat/message/keyword/update`,
        method: 'POST',
        data
    });
}

/**
 * 批量删除风险词
 * @param data 
 * @returns 
 */
export async function deleteKeywordApi(data: number[]) {
    return request({
        url: `/chat/message/keyword/deleteBatch`,
        method: 'POST',
        data
    });
}

/**
 * 启用或禁用
 * @param params 
 * @returns 
 */
export async function enableKeywordApi(params: { ids: number[], enabled: boolean }) {
    return request({
        url: `/chat/message/keyword/enable?enabled=${params.enabled}`,
        method: 'POST',
        data: params.ids,
    });
}

export interface GetKeywordListProps {
    "pageNum": number,
    "pageSize": number
    "corpId"?: string,
    "corpUserId"?: string,
    "enabled"?: boolean,
    "riskLevel"?: 1 | 2 | 3,
    "userId"?: number
}

/**
 * 获取风险词列表
 * @param data 
 * @returns 
 */
export async function getKeywordListApi(data: GetKeywordListProps) {
    return request({
        url: `/chat/message/keyword/pageList`,
        method: 'POST',
        data,
    });
}