import request from "@/utils/request";
const { api } = process.env.CONFIG;

/**
 * 获取任务统计
 * @returns 
 */
export function getTotalTaslApi() {
    return request({
        url: api + `/corpOperation/corp/stats/total/task`,
        method: 'GET'
    })
}


/**
 * 获取各模型任务统计
 * @returns 
 */
export function getTotalModelApi() {
    return request({
        url: api + `/corpOperation/corp/stats/task/model`,
        method: 'GET'
    })
}

export interface GetTaskdayProps {
    pageNum: number,
    pageSize: number,
    taskDay: string,
    taskType: string,
}

/**
 * 获取各模型任务统计
 * @returns 
 */
export function getTaskdayApi(data: GetTaskdayProps) {
    return request({
        url: api + `/corpOperation/corp/stats/task/day`,
        method: 'POST',
        data
    })
}

export interface GetPullGroupListProps {
    pageNum: number,
    pageSize: number,
    projectName?: string, // 项目名称
    groupName?: string,   // 群名称
    taskId?: string,      // 任务ID
    taskName?: string,    // 任务名称
    corpChatUserIds?: any[], // 企业群成员ID列表
    startDay?: string,  // 开始日期
    endDay?: string     // 结束日期
    projectGroupIds?: string[] // 项目组ID列表
    sortFiled?: string
    sortAsc?: boolean
    mpAccountIds?: number[]
    includeCreateBy?: boolean
}


/**
 * 群聊创建
 * @param data 
 * @returns 
 */
export function getPullGroupListApi(data: GetPullGroupListProps) {
    return request({
        url: api + `/corpOperation/corp/stats/listOfPage/pullGroup`,
        method: 'POST',
        data
    })
}

/**
 * 总计
 * @param data 
 * @returns 
 */
export function getPullGroupTotalApi(data: GetPullGroupListProps) {
    return request({
        url: api + `/corpOperation/corp/stats/listOfPage/pullGroup/total`,
        method: 'POST',
        data
    })
}

/**
 * 下载
 * @param data 
 * @returns 
 */
export function downPullGroupExcelApi(data: GetPullGroupListProps) {
    return request({
        url: api + `/corpOperation/corp/stats/listOfPage/pullGroup/excel`,
        method: 'POST',
        data,
        responseType: 'blob'
    })
}

export interface GetSendUserListProps {
    pageNum: number,
    pageSize: number,
    projectType?: 1 | 2,
    msgId?: string,
    status?: 0 | 2,
    projectName?: string,
    taskId?: any,
    expectStartDay?: string,
    expectEndDay?: string
    startDay?: string,
    endDay?: string,
    projectGroupIds?: string[]
    includeCreateBy?: boolean
}

/**
 * 下发企微号
 * @param data 
 * @returns 
 */
export function getSendUserListApi(data: GetSendUserListProps) {
    return request({
        url: api + `/corpOperation/corp/stats/listOfPage/send/user`,
        method: 'POST',
        data
    })
}

export interface GetSendUserLogListProps {
    pageNum: number,
    pageSize: number,
    projectType?: 1 | 2,
    projectName?: string,
    taskId?: any,
    startDay?: string,
    endDay?: string,
    projectGroupIds?: string[],
    includeCreateBy: boolean
}

/**
 * 群发记录
 * @param data 
 * @returns 
 */
export function getSendUserLogListApi(data: GetSendUserLogListProps) {
    return request({
        url: api + `/corpOperation/corp/stats/listOfPage/send/user/log`,
        method: 'POST',
        data
    })
}

export interface GetSendRobotLogListProps {
    pageNum: number,
    pageSize: number,
    projectName?: string,
    taskId?: any,
    status?: 0 | 2,
    expectStartDay?: string,
    expectEndDay?: string
    startDay?: string,
    endDay?: string
    projectGroupIds?: number[]
}

/**
 * 机器人转发记录
 * @param data 
 * @returns 
 */
export function getSendRobotLogListApi(data: GetSendRobotLogListProps) {
    return request({
        url: api + `/corpOperation/corp/stats/listOfPage/send/robot/log`,
        method: 'POST',
        data
    })
}

export interface GetSendMomentLogListProps {
    pageNum?: number
    pageSize?: number
    projectName?: string
    taskId?: any
    startDay?: string,
    endDay?: string
    projectGroupIds?: number[]
}

/**
 * 朋友圈下发企微号
 * @param data 
 * @returns 
 */
export function getMomentCorpUserLogListApi(data: GetSendMomentLogListProps) {
    return request({
        url: api + `/corpOperation/corp/stats/listOfPage/momentCorpUser/log`,
        method: 'POST',
        data
    })
}

/**
 * 朋友圈 群发记录
 * @param data 
 * @returns 
 */
export function getMomentJobLogListApi(data: GetSendMomentLogListProps) {
    return request({
        url: api + `/corpOperation/corp/stats/listOfPage/momentJob/log`,
        method: 'POST',
        data
    })
}

export interface GetTransferLogListProps {
    pageNum: number,
    pageSize: number,
    projectName?: string,
    taskId?: string,
    status?: 0 | 1 | 2 | 3,
    startDay?: string,
    endDay?: string
    projectGroupIds?: number[]
}

/**
 * 客户继承
 * @param data 
 * @returns 
 */
export function getTransferLogListApi(data: GetTransferLogListProps) {
    return request({
        url: api + `/corpOperation/corp/stats/listOfPage/transfer/log`,
        method: 'POST',
        data
    })
}
