// 获取当前年份
const currentYear = new Date().getFullYear()

// 定义禁用日期函数：只能选择今年及以后的日期
const disabledDate = (time: Date) => {
    // 时间早于今年1月1日则禁用
    return time.getTime() < new Date(currentYear, 0, 1).getTime()
}
//定义客户搜索表单配置
export const clientSearch = [
    {
        prop: 'username',
        label: '用户名',
        type: 'input' as const,
        placeholder: '用户名',
        width: '120px'
    },
    {
        prop: "startDateTime",
        label: '注册开始时间',
        type: 'date' as const,
        dateType: 'date' as const, // 时间范围选择器
        valueFormat: 'YYYY-MM-DD',
        // minWidth: '200px'
        width: '180',
        disabledDate
    },
    {
        prop: "endDateTime",
        label: '注册结束时间',
        type: 'date' as const,
        dateType: 'date' as const, // 时间范围选择器
        valueFormat: 'YYYY-MM-DD',
        // minWidth: '200px'
        width: '180',
        disabledDate
    },
    {
        prop: 'status',
        label: '状态',
        type: 'select' as const,
        placeholder: '选择状态',
        width: '80px',
        options: [
            { label: '正常', value: 1 },
            { label: '封禁', value: 2 }
        ],
    }
]

//定义客户table列配置
export const clientTableColumns = [
  { prop: 'id', label: 'ID', align: 'center' as const },
  { prop: 'username', label: '用户名', align: 'center' as const },
  { prop: 'createdTime', label: '注册时间', align: 'center' as const },
  { prop: 'agentUsername', label: '所属代理', align: 'center' as const },
  { prop: 'amount', label: '资金', align: 'center' as const, isNumber: true },
  { label: '状态', slotName: 'status', align: 'center' as const },
  { label: '操作', slotName: 'action', align: 'center' as const },
]

//定义添加客户form配置
export const clientAddFormItem = [
    // { prop: 'clientName', label: '客户名称', type: 'input' as const, placeholder: '客户名称' },
    // { prop: 'isUpgrade', label: '是否升级为代理', type: 'radio' as const, placeholder: '是否升级为代理' },
    { prop: 'phoneOrEmail', label: '', type: 'slot' as const, slotName: 'phoneOrEmail' },
    { prop: 'feeTemplate', label: '手续费模板', type: 'select' as const, placeholder: '选择手续费模板' },
    { prop: 'riskTemplate', label: '风控模板', type: 'select' as const, placeholder: '选择风控模板' },
    { prop: 'agentUsername', label: '所属上级', type: 'select' as const, placeholder: '所属上级' },
]

//定义修改客户form配置
export const clientChangeFormItem = [
    { prop: 'feeTemplate', label: '手续费模板', type: 'select' as const, placeholder: '选择手续费模板' },
    { prop: 'riskTemplate', label: '风控模板', type: 'select' as const, placeholder: '选择风控模板' },
    { prop: 'userName', label: '客户名称', type: 'input' as const, placeholder: '客户名称' },
    { prop: 'isUpgrade', label: '是否升级为代理', type: 'radio' as const, placeholder: '是否升级为代理', labelWidth: '140px' },
    { prop: 'status', label: '选择状态', type: 'radio' as const, placeholder: '请选择状态', labelWidth: '140px' },
]

// 国家码选项
interface CountryItem {
    name: string
    code: string
}

export const countryOptions = ref<CountryItem[]>([
    { name: '中国', code: '+86' },
    { name: '中国台湾', code: '+886' },
    { name: '中国香港', code: '+852' },
    { name: '中国澳门', code: '+853' },
    { name: '韩国', code: '+82' },
    { name: '美国', code: '+1' },
    { name: '新加坡', code: '+65' }
])