import type { ParamFieldDef } from '@/types/workflow'

export const ASSIGN_STRATEGY_OPTIONS = [
  { label: '指定车辆', value: 'fixed' },
  { label: '指定类型', value: 'byType' }
] as const

const FIXED = { key: 'strategy', equals: 'fixed' as const }
const BY_TYPE = { key: 'strategy', equals: 'byType' as const }

/** 分配车辆：指定车辆 / 指定类型 */
export function assignCarParams(): ParamFieldDef[] {
  return [
    {
      key: 'strategy',
      label: '分配策略',
      type: 'select',
      required: true,
      defaultValue: 'fixed',
      options: [...ASSIGN_STRATEGY_OPTIONS]
    },
    {
      key: 'carId',
      label: '车辆编号',
      type: 'string',
      required: true,
      placeholder: '如 C01',
      when: FIXED
    },
    {
      key: 'carType',
      label: '车辆类型',
      type: 'string',
      required: true,
      placeholder: '如 Forklift / SimpleLite.RCS.Cars.AgvCar',
      when: BY_TYPE
    }
  ]
}
