import type { Component } from 'vue';

import { fieldRegistry } from '/nerv-lib/component/form/field-registry';
import { NsButton } from '/nerv-lib/component/form/button';
import { NsSwitch } from '/nerv-lib/component/form/switch';
import { NsCheckbox } from '/nerv-lib/component/form/checkbox';
import { NsRadio } from '/nerv-lib/component/form/radio';
import { NsSelect } from '/nerv-lib/component/form/select';
import { NsInput } from '/nerv-lib/component/form/input';
import { NsDatePicker } from '/nerv-lib/component/form/date-picker';
import { NsTimePicker } from '/nerv-lib/component/form/time-picker';
import { NsEditTable } from '/nerv-lib/component/form/editTable';
import { NsCascader } from '/nerv-lib/component/form/cascader';

export const NsComponents: Array<Component> = [
  NsSwitch,
  NsButton,
  NsCheckbox,
  NsRadio,
  NsSelect,
  NsInput,
  NsDatePicker,
  NsTimePicker,
  NsCascader,
  NsEditTable,
];

NsComponents.forEach((component) => {
  fieldRegistry.push(component.name as string, component);
});

export function regForm() {
  console.log(fieldRegistry.map);
}

//todo formItem合法性检测