import request from '@/utils/request'

export function fetchBatchSendRecords(page) {
    return request({
        url: "/api/sms/records",
        method: "get",
        params: {
            page: page,
        }
    })
}

export function sendsInitData(action, id) {
    var param = {}
    if (action != null && action != undefined) {
        param.action = action
    }
    if (id != null && id != undefined) {
        param.id = id
    }
    return request({
        url: "/api/sms/sendinit",
        method: "get",
        params: param,
    })
}

export function tagFilterCustomerCount(tag_ids_str) {
    return request({
        url: "/api/sms/tagfiltercount",
        method: "get",
        params: {
            tags: tag_ids_str,
        },
    })
}

export function send2AllCustomers(content) {
    return request({
        url: "/api/sms/send2all",
        method: "post",
        params: {
            content: content,
        }
    })
}

export function send2TagCustomers(content, tag_ids) {
    return request({
        url: "/api/sms/send2tag",
        method: "post",
        params: {
            content: content,
            tags: tag_ids,
        }
    })
}

export function send2SpecificCustomers(content, customer_ids) {
    return request({
        url: "/api/sms/send2specific",
        method: "post",
        params: {
            content: content,
            ids: customer_ids,
        }
    })
}