import { AdStatus, BidModeEnum, BidStrategyEnum, OptimizationGoalEnum, PromotedObjectType, SiteSetEnum } from "@/services/launchAdq/enum"
import React from "react"


interface Props {
    data: any
}
/**
 * 广告基本信息展示
 * @returns 
 */
const AdgroupsCol = React.forwardRef((props: Props, ref) => {

    /*************************/
    const { data } = props
    const { adgroupName, promotedObjectType, siteSet, endDate, beginDate, bidMode, optimizationGoal, smartBidType, bidStrategy, amountModel, bidAmountMin, bidAmountMax, bidAmount, dailyBudget, firstDayBeginTime, configuredStatus } = data
    /*************************/

    return <>
        <div><strong>广告名称：</strong> <span style={{ color: "#5a5a5a" }}>{adgroupName}</span></div>
        <div><strong>推广目标： </strong><span style={{ color: "#5a5a5a" }}>{PromotedObjectType[promotedObjectType]}</span></div>
        <div><strong>广告版位：</strong> <span style={{ color: "#5a5a5a" }}>{siteSet?.map((item: string) => SiteSetEnum[item]).toString()}</span></div>
        <div><strong>投放日期：</strong> <span style={{ color: "#5a5a5a" }}>{endDate ? beginDate + '~' + endDate : beginDate + '~' + '长期投放'}</span></div>
        {firstDayBeginTime && <div><strong>首日时间： </strong><span style={{ color: "#5a5a5a" }}>{firstDayBeginTime}</span></div>}
        <div><strong>出价方式： </strong><span style={{ color: "#5a5a5a" }}>{BidModeEnum[bidMode]}</span></div>
        {optimizationGoal && <div><strong>优化目标：</strong> <span style={{ color: "#5a5a5a" }}>{OptimizationGoalEnum[optimizationGoal]}</span></div>}
        <div><strong>出价类型：</strong> <span style={{ color: "#5a5a5a" }}>{smartBidType === 'SMART_BID_TYPE_CUSTOM' ? '手动出价' : '自动出价'}</span></div>
        {bidStrategy && <div><strong>出价策略：</strong> <span style={{ color: "#5a5a5a" }}>{BidStrategyEnum[bidStrategy]}</span></div>}
        <div><strong>出价模式：</strong> <span style={{ color: "#5a5a5a" }}>{{'0': '固定出价', '1': '随机出价'}[amountModel]}</span></div>
        <div><strong>广告出价：</strong> <span style={{ color: "#5a5a5a" }}>{amountModel == 0 ? bidAmount : bidAmountMin + '-' + bidAmountMax}{`元/${OptimizationGoalEnum[optimizationGoal] || '千次曝光'}`}</span></div>
        <div><strong>广告日预算：</strong> <span style={{ color: "#5a5a5a" }}>{dailyBudget || '不限'}</span></div>
        <div><strong>广告状态：</strong> <span style={{ color: "#5a5a5a" }}>{AdStatus[configuredStatus || 'AD_STATUS_SUSPEND']}</span></div>
    </>
})

export default React.memo(AdgroupsCol)