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

import { STATUS_OPTIONS } from './constants';

/** AI 平台新增/编辑表单 */
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',
      formItemClass: 'col-span-6',
      help: '小写蛇形，如 spark / deepseek，须与 Agent 工厂一致',
      componentProps: { placeholder: 'spark' },
    },
    {
      component: 'VbenInput',
      fieldName: 'name',
      label: '平台名称',
      rules: 'required',
      formItemClass: 'col-span-6',
      componentProps: { placeholder: '讯飞星火' },
    },
    {
      component: 'VbenInput',
      fieldName: 'api_url',
      label: '接口地址',
      componentProps: {
        placeholder: 'https://xxx/v1/chat/completions',
      },
      defaultValue: '',
    },
    {
      component: 'VbenSelect',
      fieldName: 'status',
      label: '状态',
      formItemClass: 'col-span-6',
      componentProps: { options: STATUS_OPTIONS },
      defaultValue: 1,
    },
    {
      component: 'InputNumber',
      fieldName: 'sort',
      label: '排序',
      formItemClass: 'col-span-6',
      componentProps: { min: 0 },
      defaultValue: 0,
    },
    {
      component: 'Avatar',
      fieldName: 'logo',
      label: 'Logo',
      help: '卡片展示用；默认模型请在下方「模型」卡片中设置',
      defaultValue: '',
    },
    {
      component: 'VbenInput',
      fieldName: 'description',
      label: '说明',
      componentProps: { type: 'textarea', rows: 2, placeholder: '平台简介' },
      defaultValue: '',
    },
  ],
  showDefaultActions: false,
};
