import { HeartFilled, HeartOutlined } from "@ant-design/icons"
import React from "react"

export function columnsMp(collect: (arg: { id: any, c: boolean, name: 'adq' | 'mp' }) => void): any {
    return [
        {
            title: '收藏',
            dataIndex: 'cz',
            align: 'center',
            key: 'cz',
            width: 50,
            fixed: 'left',
            render: (a: any, b: any) => {
                return b?.collected ? <a onClick={() => {
                    collect({ id: b.id, c: false, name: 'mp' })
                }}><HeartFilled style={{ color: 'red' }} /></a> : <a onClick={() => {
                    collect({ id: b.id, c: true, name: 'mp' })
                }}><HeartOutlined /></a>
            },
        },
        {
            fixed: 'left',
            title: '广告主名称',
            dataIndex: 'uname',
            key: 'uname',
            align: 'center',
            ellipsis: true,
            width: 100
        },
        {
            title: 'AppId',
            dataIndex: 'appid',
            key: 'appid',
            align: 'center',
            ellipsis: true,
            width: 160
        },
        {
            title: '原始ID',
            dataIndex: 'wxname',
            key: 'wxname',
            align: 'center',
            ellipsis: true,
            width: 140,
        },
        {
            title: '账号ID',
            dataIndex: 'uid',
            key: 'uid',
            align: 'center',
            ellipsis: true,
            width: 90,
        },
        {
            title: '所属服务商SPID',
            dataIndex: 'spid',
            key: 'spid',
            width: 120,
            ellipsis: true,
            align: 'center',
        },
        {
            title: '主体名称',
            dataIndex: 'companyName',
            key: 'companyName',
            ellipsis: true,
            width: 300
        },
    ]
}
export function columnsAdq(collect: (arg: { id: any, c: boolean, name: 'adq' | 'mp' }) => void): any {
    return [
        {
            title: '收藏',
            dataIndex: 'cz',
            align: 'center',
            key: 'cz',
            width: 50,
            render: (a: any, b: any) => {
                return b?.collected ? <a onClick={() => {
                    collect({ id: b.id, c: false, name: 'adq' })
                }}><HeartFilled style={{ color: 'red' }} /></a> : <a onClick={() => {
                    collect({ id: b.id, c: true, name: 'adq' })
                }}><HeartOutlined /></a>
            },
        },
        {
            title: '账号ID',
            dataIndex: 'uid',
            key: 'uid',
            align: 'center',
            ellipsis: true,
            width: 90,
        },
        {
            title: '广告主名称',
            dataIndex: 'uname',
            key: 'uname',
            align: 'center',
            ellipsis: true,
            width: 200
        }
    ]
}