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

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

const BY_CAR_ID = { key: 'strategy', equals: 'carId' as const }
const BY_CAR_TYPE = { key: 'strategy', equals: 'carType' as const }

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