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

/**
 * 编辑弹窗表单（遗留 schema，实际编辑走 components/modal.vue 自定义布局）
 * task_code / name 只读；封面图与跳转链接分存
 */
export const modalFormProps: VbenFormProps = {
  wrapperClass: 'grid-cols-1',
  commonConfig: {
    formItemClass: 'col-span-1',
    componentProps: {
      class: 'w-full',
    },
  },
  layout: 'horizontal',
  schema: [
    {
      component: 'VbenInput',
      fieldName: 'id',
      label: 'ID',
      dependencies: {
        show: false,
        triggerFields: ['id'],
      },
    },
    {
      component: 'VbenInput',
      fieldName: 'name',
      label: '任务名称',
      componentProps: {
        disabled: true,
      },
    },
    {
      component: 'VbenInput',
      fieldName: 'task_code',
      label: '任务编码',
      componentProps: {
        disabled: true,
      },
      help: '与 Artisan 命令绑定，不可修改',
    },
    {
      component: 'VbenInput',
      fieldName: 'scene_code',
      label: '场景编码',
      rules: 'required',
      help: '对应 OA 场景 scene_code，推送走 OaNotifyService.dispatch',
      componentProps: {
        placeholder: '如 unpaid_unshipped_hourly',
        disabled: true,
      },
    },
    {
      component: 'RadioGroup',
      fieldName: 'enabled',
      label: '启停',
      rules: 'selectRequired',
      defaultValue: 0,
      componentProps: {
        options: [
          { label: '启用', value: 1 },
          { label: '禁用', value: 0 },
        ],
      },
    },
    {
      component: 'UploadImage',
      fieldName: 'card_image_urls',
      label: '卡片图',
      help: '作为 vars.card_image；与 jump_url 分存',
      componentProps: {
        maxCount: 1,
        multiple: false,
        acceptTypes: [0],
      },
    },
    {
      component: 'VbenInput',
      fieldName: 'jump_url',
      label: '跳转链接',
      help: '作为 vars.jump_url；与 card_image_url 分存',
      componentProps: {
        placeholder: 'https://...',
      },
    },
    {
      component: 'Textarea',
      fieldName: 'remark',
      label: '备注',
      componentProps: {
        rows: 3,
        placeholder: 'crontab 建议等说明',
      },
    },
  ],
  showDefaultActions: false,
};
