import type { VbenFormProps } from '#/adapter/form';

import { COLOR_OPTIONS, STATUS_OPTIONS } from './constants';

/** 站内信类型表单 */
export const modalFormProps: VbenFormProps = {
  wrapperClass: 'grid-cols-12',
  commonConfig: {
    formItemClass: 'col-span-12',
    componentProps: { class: 'w-full' },
  },
  layout: 'horizontal',
  schema: [
    {
      component: 'VbenInput',
      fieldName: 'id',
      label: 'ID',
      dependencies: { show: false, triggerFields: ['id'] },
    },
    {
      component: 'VbenInput',
      fieldName: 'code',
      label: '类型编码',
      rules: 'required',
      componentProps: { placeholder: 'snake_case，如 withdraw_audit' },
    },
    {
      component: 'VbenInput',
      fieldName: 'name',
      label: '展示名称',
      rules: 'required',
      componentProps: { placeholder: '如：提现待审' },
    },
    {
      component: 'VbenInput',
      fieldName: 'icon',
      label: '图标',
      componentProps: {
        placeholder: 'iconify 名，如 ant-design:bell-outlined',
      },
      defaultValue: '',
    },
    {
      component: 'VbenInput',
      fieldName: 'cover_url',
      label: '封面图',
      componentProps: { placeholder: '可选图片 URL' },
      defaultValue: '',
    },
    {
      component: 'VbenSelect',
      fieldName: 'color',
      label: '主题色',
      formItemClass: 'col-span-6',
      componentProps: { options: COLOR_OPTIONS },
      defaultValue: 'sky',
    },
    {
      component: 'InputNumber',
      fieldName: 'sort',
      label: '排序',
      formItemClass: 'col-span-6',
      componentProps: { min: 0 },
      defaultValue: 0,
    },
    {
      component: 'VbenSelect',
      fieldName: 'status',
      label: '状态',
      componentProps: { options: STATUS_OPTIONS },
      defaultValue: 1,
    },
  ],
  showDefaultActions: false,
};
