import { Badge } from "antd"
import { ColumnsType } from "antd/es/table"

export function WelcomeMsgCorpUserListConfig(): ColumnsType<any> {

    let arr: ColumnsType<any> = [
        {
            title: '企微号',
            dataIndex: 'corpUserName',
            key: 'corpUserName',
            align: 'center',
            width: 80,
            ellipsis: true,
        },
        {
            title: '所属企业',
            dataIndex: 'corpName',
            key: 'corpName',
            align: 'center',
            width: 120,
            ellipsis: true,
        },
        {
            title: '预计送达数',
            dataIndex: 'sendCount',
            key: 'sendCount',
            align: 'center',
            width: 90,
            ellipsis: true,
            render: (a) => {
                return a > 0 ? a : 0
            }
        },
        {
            title: '消息ID',
            dataIndex: 'jobId',
            key: 'jobId',
            align: 'center',
            width: 65,
            ellipsis: true,
        },
        {
            title: '发送成功',
            dataIndex: 'sendSuccessCount',
            key: 'sendSuccessCount',
            align: 'center',
            width: 80,
            render: (a) => {
                return a > 0 ? a : 0
            }
        },
        {
            title: '发送失败',
            dataIndex: 'sendFailedCount',
            key: 'sendFailedCount',
            align: 'center',
            width: 80,
            render: (a) => {
                return a > 0 ? a : 0
            }
        },
        {
            title: '评论数',
            dataIndex: 'commentCount',
            key: 'commentCount',
            align: 'center',
            width: 65,
            ellipsis: true,
        },
        {
            title: '点赞数',
            dataIndex: 'likeCount',
            key: 'likeCount',
            align: 'center',
            width: 65,
            ellipsis: true,
        },
        {
            title: '发送时间',
            dataIndex: 'sendTime',
            key: 'sendTime',
            align: 'center',
            width: 80,
        },
        {
            title: '发送状态',
            dataIndex: 'sendStatus',
            key: 'sendStatus',
            align: 'center',
            width: 80,
            render: (a) => {
                return <Badge text={a === 1 ? '已确认发送' : '未确认发送'} status={a === 1 ? 'success' : 'error'} />
            }
        }
    ]
    return arr
}



export function sendLogTableConfig(): ColumnsType<any> {
    
    return [
        {
            title: '消息ID',
            dataIndex: 'jobId',
            key: 'jobId',
            width: 70,
            ellipsis: true
        },
        {
            title: '发送时间',
            dataIndex: 'createTime',
            key: 'createTime',
            width: 110
        },
        {
            title: '任务日志',
            dataIndex: 'jobLog',
            key: 'jobLog',
            width: 250,
            ellipsis: true
        },
        {
            title: '任务状态',
            dataIndex: 'jobStatus',
            key: 'jobStatus',
            width: 110,
            ellipsis: true
        },
    ]
}