import { Statistic } from "antd";
import { AnyObject } from "antd/es/_util/type"
import { ColumnsType } from "antd/es/table"


export const CorpExternalUserColumns = (): ColumnsType<AnyObject> => {

    return [
        {
            title: '企业名称',
            dataIndex: 'corpName',
            key: 'corpName',
            ellipsis: true,
            width: 150,
        },
        {
            title: '粉丝总数',
            dataIndex: 'userCount',
            key: 'userCount',
            align: 'center',
            render: (text: any) => <Statistic value={text || 0} valueStyle={{ fontSize: 12 }} />
        },
        {
            title: '未识别人数',
            dataIndex: 'wsbrsCount',
            key: 'wsbrsCount',
            align: 'center',
            render: (text: any) => <Statistic value={text || 0} valueStyle={{ fontSize: 12 }} />
        },
        {
            title: '重复总人数',
            dataIndex: 'cfCount',
            key: 'cfCount',
            align: 'center',
            render: (text: any) => <Statistic value={text || 0} valueStyle={{ fontSize: 12 }} />
        },
        {
            title: '非重人数',
            dataIndex: 'oneRepeatCount',
            key: 'oneRepeatCount',
            align: 'center',
            render: (text: any) => <Statistic value={text || 0} valueStyle={{ fontSize: 12 }} />
        },
        {
            title: '非重人数比例',
            dataIndex: 'oneRepeatCountRate',
            key: 'oneRepeatCountRate',
            align: 'center',
            render: (text: any) => <Statistic
                value={text ? text * 100 : 0}
                valueStyle={text > 0.5 ? { color: '#cf1322', fontSize: 12 } : { color: '#3f8600', fontSize: 12 }}
                suffix="%"
                precision={4}
            />
        },
        {
            title: '添加2名客服人数',
            dataIndex: 'twoRepeatCount',
            key: 'twoRepeatCount',
            align: 'center',
            render: (text: any) => <Statistic value={text || 0} valueStyle={{ fontSize: 12 }} />
        },
        {
            title: '添加2名客服人数比例',
            dataIndex: 'twoRepeatCountRate',
            key: 'twoRepeatCountRate',
            align: 'center',
            render: (text: any) => <Statistic
                value={text ? text * 100 : 0}
                valueStyle={text > 0.1 ? { color: '#cf1322', fontSize: 12 } : { color: '#3f8600', fontSize: 12 }}
                suffix="%"
                precision={4}
            />
        },
        {
            title: '添加3名客服人数',
            dataIndex: 'threeRepeatCount',
            key: 'threeRepeatCount',
            align: 'center',
            render: (text: any) => <Statistic value={text || 0} valueStyle={{ fontSize: 12 }} />
        },
        {
            title: '添加3名客服人数比例',
            dataIndex: 'threeRepeatCountRate',
            key: 'threeRepeatCountRate',
            align: 'center',
            render: (text: any) => <Statistic
                value={text ? text * 100 : 0}
                valueStyle={text > 0.09 ? { color: '#cf1322', fontSize: 12 } : { color: '#3f8600', fontSize: 12 }}
                suffix="%"
                precision={4}
            />
        },
        {
            title: '添加4名客服人数',
            dataIndex: 'fourRepeatCount',
            key: 'fourRepeatCount',
            align: 'center',
            render: (text: any) => <Statistic value={text || 0} valueStyle={{ fontSize: 12 }} />
        },
        {
            title: '添加4名客服人数比例',
            dataIndex: 'fourRepeatCountRate',
            key: 'fourRepeatCountRate',
            align: 'center',
            render: (text: any) => <Statistic
                value={text ? text * 100 : 0}
                valueStyle={text > 0.08 ? { color: '#cf1322', fontSize: 12 } : { color: '#3f8600', fontSize: 12 }}
                suffix="%"
                precision={4}
            />
        },
        {
            title: '添加5名客服人数',
            dataIndex: 'fiveRepeatCount',
            key: 'fiveRepeatCount',
            align: 'center',
            render: (text: any) => <Statistic value={text || 0} valueStyle={{ fontSize: 12 }} />
        },
        {
            title: '添加5名客服人数比例',
            dataIndex: 'fiveRepeatCountRate',
            key: 'fiveRepeatCountRate',
            align: 'center',
            render: (text: any) => <Statistic
                value={text ? text * 100 : 0}
                valueStyle={text > 0.07 ? { color: '#cf1322', fontSize: 12 } : { color: '#3f8600', fontSize: 12 }}
                suffix="%"
                precision={4}
            />
        },
        {
            title: '添加5名客服以上人数',
            dataIndex: 'gtFiveRepeatCount',
            key: 'gtFiveRepeatCount',
            align: 'center',
            render: (text: any) => <Statistic value={text || 0} valueStyle={{ fontSize: 12 }} />
        },
        {
            title: '添加5名客服以上人数比例',
            dataIndex: 'gtFiveRepeatCountRate',
            key: 'gtFiveRepeatCountRate',
            align: 'center',
            render: (text: any) => <Statistic
                value={text ? text * 100 : 0}
                valueStyle={text > 0.06 ? { color: '#cf1322', fontSize: 12 } : { color: '#3f8600', fontSize: 12 }}
                suffix="%"
                precision={4}
            />
        },
    ]
}



export const ExternalUserColumns = (): ColumnsType<AnyObject> => {

    return [
        {
            title: '企业名称',
            dataIndex: 'corpName',
            key: 'corpName',
            ellipsis: true,
            width: 150,
        },
        {
            title: '主体用户总数',
            dataIndex: 'corpExternalUserCount',
            key: 'corpExternalUserCount',
            align: 'center',
            render: (text: any) => <Statistic value={text || 0} valueStyle={{ fontSize: 12 }} />
        },
        {
            title: '已识别用户数',
            dataIndex: 'ysbCount',
            key: 'ysbCount',
            align: 'center',
            render: (text: any) => <Statistic value={text || 0} valueStyle={{ fontSize: 12 }} />
        },
        {
            title: '未识别用户数',
            dataIndex: 'nsbCount',
            key: 'nsbCount',
            align: 'center',
            render: (text: any) => <Statistic value={text || 0} valueStyle={{ fontSize: 12 }} />
        },
        {
            title: '主体用户在集团占比',
            dataIndex: 'corpExternalUserRate',
            key: 'corpExternalUserRate',
            align: 'center',
            render: (text: any) => <Statistic
                value={text ? text * 100 : 0}
                valueStyle={text > 0.2 ? { color: '#cf1322', fontSize: 12 } : { color: '#3f8600', fontSize: 12 }}
                suffix="%"
                precision={4}
            />
        },
        {
            title: '主体客服号数量',
            dataIndex: 'corpUserCount',
            key: 'corpUserCount',
            align: 'center',
            render: (text: any) => <Statistic value={text || 0} valueStyle={{ fontSize: 12 }} />
        },
        {
            title: '主体内重粉数',
            dataIndex: 'corpExternalUserRepeatCount',
            key: 'corpExternalUserRepeatCount',
            align: 'center',
            render: (text: any) => <Statistic value={text || 0} valueStyle={{ fontSize: 12 }} />
        },
        {
            title: '主体内重粉率',
            dataIndex: 'corpExternalUserRepeatRate',
            key: 'corpExternalUserRepeatRate',
            align: 'center',
            render: (text: any) => <Statistic
                value={text ? text * 100 : 0}
                valueStyle={text > 0.2 ? { color: '#cf1322', fontSize: 12 } : { color: '#3f8600', fontSize: 12 }}
                suffix="%"
                precision={4}
            />
        },
    ]
}