import { SourceSystemEnum } from "@/components/QueryForm/const"
import { CheckCircleOutlined, StopOutlined } from "@ant-design/icons"
import { Badge, Popconfirm } from "antd"
import React from "react"


function columns12(interdictionHandle: (userId: number, status: number) => void) {

    let newArr: any[] = [
        {
            title: 'SDK来源',
            dataIndex: 'source_system',
            key: 'source_system',
            width: 70,
            align: 'center',
            ellipsis: true,
            render: (a: any) => SourceSystemEnum[a],
        },
        {
            title: '玩家ID',
            dataIndex: 'user_id',
            key: 'user_id',
            ellipsis: true,
            width: 65,
            align: 'center'
        },
        {
            title: '玩家账号',
            dataIndex: 'username',
            key: 'username',
            ellipsis: true
        },
        {
            title: '玩家昵称',
            dataIndex: 'nickname',
            key: 'nickname',
            ellipsis: true,
            width: 140
        },
        {
            title: '最近游戏角色ID',
            dataIndex: 'role_id',
            key: 'role_id',
            width: 155,
            ellipsis: true
        },
        {
            title: '最近游戏角色名',
            dataIndex: 'role_name',
            key: 'role_name',
            ellipsis: true,
            width: 110,
            align: 'center'
        },
        {
            title: '玩家状态',
            dataIndex: 'status',
            key: 'status',
            align: 'center',
            width: 70,
            render: (a: any) => {
                return { '3': <Badge status="error" text="冻结" />, '2': <Badge status="success" text="正常" />, '1': <Badge status="warning" text="试玩" /> }[a]
            }
        },
        {
            title: '操作',
            dataIndex: 'cz',
            key: 'cz',
            width: 75,
            align: 'center',
            render: (a: any, b: any) => <Popconfirm
                title={(b?.status == '1' || b?.status == '2') ? `确定封禁?` : `确定解封?`}
                onConfirm={() => { interdictionHandle(b?.user_id, (b?.status == '1' || b?.status == '2') ? 1 : 0) }}
                okText="是"
                cancelText="否"
            >
                <a style={{ fontSize: "12px", color: (b?.status == '1' || b?.status == '2') ? 'red' : '#52c41a' }}> {(b?.status == '1' || b?.status == '2') ? <><StopOutlined /> 封禁</> : <><CheckCircleOutlined /> 解封</>}</a>
            </Popconfirm>
        },
    ]

    return newArr
}

export default columns12