import type { Component } from 'vue';
import {
  Input,
  Select,
  Checkbox,
  InputNumber,
  Switch,
  DatePicker,
  TimePicker,
  Cascader,
} from 'ant-design-vue';
import type { ComponentType } from './types/componentType';

export enum EventEnum {
  Input = 'on-change',
  InputNumber = 'on-change',
  Select = 'on-change',
  Switch = 'on-change',
  Checkbox = 'on-change',
  DatePicker = 'on-change',
  TimePicker = 'on-change',
  Cascader = 'on-change',
}

const componentMap = new Map<ComponentType, Component>();

componentMap.set('Input', Input);
componentMap.set('InputNumber', InputNumber);
componentMap.set('Select', Select);
componentMap.set('Switch', Switch);
componentMap.set('Checkbox', Checkbox);
componentMap.set('DatePicker', DatePicker);
componentMap.set('TimePicker', TimePicker);
componentMap.set('Cascader', Cascader);

export function add(compName: ComponentType, component: Component) {
  componentMap.set(compName, component);
}

export function del(compName: ComponentType) {
  componentMap.delete(compName);
}

export { componentMap };
