/**
 * 字段类型到图标的映射常量
 *
 * 默认图标 URL 在此定义，业务侧可通过主题资产覆盖 fieldTypeIcons。
 */
import { LOOKUP_FIELD_ICON_URL } from './lookup-field-icon';
import { AI_TABLE_ICONS } from './ai-table-icons';
import { FORMULA_FIELD_ICON_URL } from './formula-field-icon';
// 图标 URL 常量定义
const ICON_URLS = {
    // 文本输入类图标
    TEXT_INPUT: 'https://img.alicdn.com/imgextra/i3/O1CN01QkHwY11LY1xq3VmVx_!!6000000001310-55-tps-16-16.svg',
    // 人员选择图标
    EMPLOYEE_SELECT: 'https://img.alicdn.com/imgextra/i2/O1CN0104MOzt1Quzu72kHW9_!!6000000002037-55-tps-16-16.svg',
    // 部门选择图标
    DEPARTMENT_SELECT: 'https://img.alicdn.com/imgextra/i2/O1CN01536QCU26AvvnBCjzP_!!6000000007622-55-tps-16-16.svg',
    // 数值选择器图标
    NUMBER_PICKER: 'https://img.alicdn.com/imgextra/i1/O1CN01qO0bgT1oBF7BSh3xM_!!6000000005186-55-tps-16-16.svg',
    // 币种金额图标
    CURRENCY_AMOUNT: 'https://img.alicdn.com/imgextra/i1/O1CN01LbbzUn1QtciRVpmfj_!!6000000002034-55-tps-16-16.svg',
    // 时间类图标
    DATE_TIME: 'https://img.alicdn.com/imgextra/i2/O1CN01X7ZqjG1YPruXbmRuI_!!6000000003052-55-tps-16-16.svg',
    // Range 组件图标
    RANGE: 'https://img.alicdn.com/imgextra/i4/O1CN01deizn41okVc0x6UJ4_!!6000000005263-55-tps-16-16.svg',
    // 单选组件图标
    RADIO: 'https://img.alicdn.com/imgextra/i3/O1CN017Mekj01KmrAYNDX4f_!!6000000001207-55-tps-16-16.svg',
    // 多选组件图标
    CHECKBOX: 'https://img.alicdn.com/imgextra/i3/O1CN01nVFdh31D1xIgApUkm_!!6000000000157-55-tps-16-16.svg',
    // 地址组件图标
    ADDRESS: 'https://img.alicdn.com/imgextra/i2/O1CN01ZVtX321qwXFBY4A8h_!!6000000005560-55-tps-16-16.svg',
    // 评分组件图标
    RATING: 'https://img.alicdn.com/imgextra/i1/O1CN0194aMKe1y4VRhNcPYI_!!6000000006525-55-tps-16-16.svg',
    // 上传组件图标
    UPLOAD: 'https://img.alicdn.com/imgextra/i2/O1CN01nHq45z1LvG9zFJXVH_!!6000000001360-2-tps-40-40.png',
    // 链接组件图标
    LINK: 'https://img.alicdn.com/imgextra/i3/O1CN01Mva3Vy1QfTrnSWEXU_!!6000000002003-2-tps-40-40.png',
    /** 引用（lookup）字段 — 矢量 data URL */
    LOOKUP_FIELD: LOOKUP_FIELD_ICON_URL,
    // 默认图标
    DEFAULT: 'https://img.alicdn.com/imgextra/i2/O1CN01eiqEmL1On5pwXes06_!!6000000001749-55-tps-16-16.svg',
};
/**
 * 批量创建字段类型到图标的映射（内部辅助函数）
 * @param fieldTypes 字段类型数组
 * @param iconUrl 图标 URL
 * @returns 字段类型到图标的映射对象
 */
function createFieldIconMap(fieldTypes, iconUrl) {
    const initialValue = {};
    return fieldTypes.reduce((acc, fieldType) => {
        acc[fieldType] = iconUrl;
        return acc;
    }, initialValue);
}
// 字段类型到图标的映射
export const FIELD_TYPE_ICONS = {
    // 文本输入类组件
    ...createFieldIconMap(['CnInput', 'CnTextArea', 'Input', 'TextArea'], ICON_URLS.TEXT_INPUT),
    // 人员选择组件
    ...createFieldIconMap(['CnEmployeeSelect', 'EmployeeSelect'], ICON_URLS.EMPLOYEE_SELECT),
    // 部门选择组件
    ...createFieldIconMap(['CnDepartmentSelect', 'DepartmentSelect'], ICON_URLS.DEPARTMENT_SELECT),
    // 数值选择器组件
    ...createFieldIconMap(['CnNumberPicker', 'NumberPicker'], ICON_URLS.NUMBER_PICKER),
    // 币种金额组件
    CnCurrencyAmountNumberPickerPro: ICON_URLS.CURRENCY_AMOUNT,
    // 时间类组件
    ...createFieldIconMap([
        'CnDatePickerPro',
        'CnTimePickerPro',
        'CnRangeDatePickerPro',
        'CnRangeTimePickerPro',
        'DatePicker',
        'TimePicker',
        'RangePicker',
        'RangeTimePicker',
    ], ICON_URLS.DATE_TIME),
    // Range 组件
    ...createFieldIconMap(['CnRange', 'Range'], ICON_URLS.RANGE),
    // 单选组件
    ...createFieldIconMap(['CnRadio', 'RadioGroup'], ICON_URLS.RADIO),
    // 多选组件
    ...createFieldIconMap(['CnCheckbox', 'CheckboxGroup'], ICON_URLS.CHECKBOX),
    // 地址组件
    ...createFieldIconMap(['AddressSelect', 'CnAddress'], ICON_URLS.ADDRESS),
    // 评分组件
    ...createFieldIconMap(['Rating', 'CnRating'], ICON_URLS.RATING),
    // 其他组件
    CnUpload: ICON_URLS.UPLOAD,
    CnLink: ICON_URLS.LINK,
    /** AI 字段 */
    CnAiField: AI_TABLE_ICONS.FIELD_AI,
    /** 公式字段 */
    CnFormulaField: FORMULA_FIELD_ICON_URL,
    /** 引用字段：columnDefinitions.format === lookup 且无 fieldMap 时使用 */
    CnLookupField: ICON_URLS.LOOKUP_FIELD,
    default: ICON_URLS.DEFAULT,
};
