import type { ExtractPropTypes } from 'vue'
import { pick } from '@daysnap/utils'
import { horCellProps } from '../hor-cell'
import { makeStringProp, makeBooleanProp, makeNumberProp, makeArrayProp } from '../utils'

export type horTextareaPhrasesOptionsItem = {
  value: string
  [key: string]: any
}
export const horTextareaProps = {
  ...pick(horCellProps, ['label', 'required', 'icon']),

  placeholder: makeStringProp('请输入'),
  modelValue: makeStringProp(''),
  disabled: makeBooleanProp(false),
  maxlength: makeNumberProp(null),
  autoTruncation: makeBooleanProp(true), // 超出maxlength，是否自动截取，
  tipText: makeStringProp(''),
  options: makeArrayProp<horTextareaPhrasesOptionsItem>([]),
  voiceInput: {
    type: Function,
  },
  addRemark: {
    type: Function,
  },
}

export type HorTextareaProps = ExtractPropTypes<typeof horTextareaProps>
