import { Tooltip } from "antd"
import React from "react"
import style from './index.less'
import { BidModeEnum, OptimizationGoalEnum, PromotedObjectType, SiteSetEnum } from "@/services/launchAdq/enum";
let columns = () => {

    return [
        {
            title: '媒体账户',
            dataIndex: 'adAccountId',
            key: 'adAccountId',
            align: 'center',
            width: 85,
            fixed: 'left'
        },
        {
            title: '广告名称',
            dataIndex: 'adgroupName',
            key: 'adgroupName',
            align: 'center',
            width: 120,
            render: (a: any, b: any) => {
                return <span style={{ fontSize: "12px" }}>{b?.sysAdGroupData?.adgroupName}</span>
            }
        },
        {
            title: '推广目标',
            dataIndex: 'promotedObjectType',
            key: 'promotedObjectType',
            align: 'center',
            width: 85,
            render: (a: any, b: any) => {
                return <span style={{ fontSize: "12px" }}>{PromotedObjectType[a]}</span>
            }
        },
        {
            title: '推广版位',
            dataIndex: 'sysAdGroupData',
            key: 'sysAdGroupData',
            align: 'center',
            width: 120,
            render: (a: any, b: any) => {
                return <span style={{ fontSize: "12px" }}>{a?.siteSet?.map((item: string) => SiteSetEnum[item]).toString()}</span>
            }
        },
        {
            title: '投放日期',
            dataIndex: 'beginDate',
            key: 'beginDate',
            align: 'center',
            width: 100,
            render: (a: any, b: any) => {
                return <span style={{ fontSize: "12px" }}>{b?.sysAdGroupData?.endDate ? b?.sysAdGroupData?.beginDate + '~' + b?.sysAdGroupData?.endDate : b?.sysAdGroupData?.beginDate + '~ 长期投放'}</span> 
            }
        },
        {
            title: '投放时段',
            dataIndex: 'date_set1',
            key: 'date_set1',
            align: 'center',
            width: 80,
            render: (a: any, b: any) => {
                return <span style={{ fontSize: "12px" }}>全天投放</span>
            }
        },
        {
            title: '每日预算',
            dataIndex: 'dailyBudget',
            key: 'dailyBudget',
            align: 'center',
            width: 80,
            render: (a: any, b: any) => {
                return <span style={{ fontSize: "12px" }}>{b?.sysAdGroupData?.dailyBudget || '不限'}</span>
            }
        },
        {
            title: '出价方式',
            dataIndex: 'bidMode',
            key: 'bidMode',
            align: 'center',
            width: 80,
            render: (a: any, b: any) => {
                return <span style={{ fontSize: "12px" }}>{BidModeEnum[b?.sysAdGroupData?.bidMode]}</span>
            }
        },
        {
            title: '出价',
            dataIndex: 'bidAmount',
            key: 'bidAmount',
            align: 'center',
            width: 80,
            render: (a: any, b: any) => {
                return <span style={{ fontSize: "12px" }}>{b?.sysAdGroupData?.bidAmount}</span>
            }
        },
        {
            title: '优化目标',
            dataIndex: 'optimizationGoal',
            key: 'optimizationGoal',
            align: 'center',
            width: 80,
            render: (a: any, b: any) => {
                return <span style={{ fontSize: "12px" }}>{OptimizationGoalEnum[b?.sysAdGroupData?.optimizationGoal]}</span>
            }
        },
        {
            title: '出价类型',
            dataIndex: 'smartBidType',
            key: 'smartBidType',
            align: 'center',
            width: 80,
            render: (a: any, b: any) => {
                return <span style={{ fontSize: "12px" }}>{b?.sysAdGroupData?.smartBidType === 'SMART_BID_TYPE_CUSTOM' ? '手动出价' : '自动出价'}</span>
            }
        },
        {
            title: '创意名称',
            dataIndex: 'adcreativeName',
            key: 'adcreativeName',
            align: 'center',
            width: 120,
            render: (a: any, b: any) => {
                return <div className={style.twoText}>
                    <Tooltip title={b?.sysAdcreativeData?.adcreativeName}>
                        <span style={{ fontSize: "12px" }}>{b?.sysAdcreativeData?.adcreativeName}</span>
                    </Tooltip>
                </div>
            }
        },
        {
            title: '创意形式',
            dataIndex: 'adcreativeTemplateAppellation',
            key: 'adcreativeTemplateAppellation',
            align: 'center',
            width: 120,
            render: (a: any, b: any) => {
                return <span style={{ fontSize: "12px" }}>{b?.sysAdcreativeData?.adcreativeTemplateAppellation}</span>
            }
        },
        {
            title: '创意文案',
            dataIndex: 'description',
            key: 'description',
            width: 200,
            render: (a: any, b: any) => {
                return <span style={{ fontSize: "12px" }}>{b?.sysAdcreativeData?.adcreativeElements?.description}</span>
            }
        },
        {
            title: '文案',
            dataIndex: 'title',
            key: 'title',
            width: 150,
            render: (a: any, b: any) => {
                return <span style={{ fontSize: "12px" }}>{b?.sysAdcreativeData?.adcreativeElements?.title || '<空>'}</span>
            }
        },
        {
            title: '落地页名称',
            dataIndex: 'pageData',
            key: 'pageData',
            align: 'center',
            width: 120,
            render: (a: any, b: any) => {
                return <div className={style.twoText}>
                    <Tooltip title={a?.pageName}>
                        <span style={{ fontSize: "12px" }}>{a?.pageName}</span>
                    </Tooltip>
                </div>
            }
        },
        {
            title: '定向名称',
            dataIndex: 'targetingData',
            key: 'targetingData',
            align: 'center',
            width: 120,
            render: (a: any, b: any) => {
                return <div className={style.twoText}>
                    {
                        a?.targetingName ? <Tooltip title={a?.targetingName}>
                            <span style={{ fontSize: "12px" }}>{a?.targetingName}</span>
                        </Tooltip> : '<空>'
                    }
                </div>
            }
        },
        {
            title: '定向用户群',
            dataIndex: 'customAudienceList',
            key: 'customAudienceList',
            align: 'center',
            width: 180,
            render: (a: any, b: any) => {
                let names = a?.map((item: any) => item.name)
                return <div className={style.twoText}>
                    {
                        names?.length > 0 ? <Tooltip title={names.toString()}>
                            <span style={{ fontSize: "12px" }}>{names.toString()}</span>
                        </Tooltip> : '<空>'
                    }
                </div>
            }
        },
        {
            title: '排除用户群',
            dataIndex: 'excludedCustomAudienceList',
            key: 'excludedCustomAudienceList',
            align: 'center',
            width: 180,
            render: (a: any, b: any) => {
                let names = a?.map((item: any) => item.name)
                return <div className={style.twoText}>
                    {
                        names?.length > 0 ? <Tooltip title={names.toString()}>
                            <span style={{ fontSize: "12px" }}>{names.toString()}</span>
                        </Tooltip> : '<空>'
                    }
                </div>
            }
        },
        {
            title: '商品',
            dataIndex: 'productList',
            key: 'productList',
            width: 180,
            align: 'center',
            render: (a: any, b: any) => {
                if (a && a?.length > 0) {
                    let data = a[0]
                    if (data) {
                        return <span style={{ fontSize: "12px" }}>{data?.productName + '-' + data?.firstCatalogName + '-' + data?.secondCatalogName}</span>
                    }
                    return '<空>'
                } else {
                    return '<空>'
                }
            }
        },
        {
            title: '数据源',
            dataIndex: 'userActionSetsList',
            key: 'userActionSetsList',
            width: 320,
            render: (a: any, b: any) => {
                if (a && a?.length > 0) {
                    return <span style={{ fontSize: "12px" }}>{a?.map((item: any) => item?.name + '>' + item?.type)?.toString() || '<空>'}</span>
                } else {
                    return '<空>'
                }
            }
        }
    ]
}

export default columns