type TInput = {
  key: string
  name: string
  type: string
}

export const createInitialValue = (format: TInput[], moreProperties?: any) => {
  let initialValue = {}
  format.map((input: TInput) => {
    switch (input.type) {
      case 'TagsInput':
        Object.assign(initialValue, { [input.key]: [] })
        break
      case 'MultiSelect':
        Object.assign(initialValue, { [input.key]: [] })
        break
      case 'Switch':
        Object.assign(initialValue, { [input.key]: false })
        break
      case 'Rating':
        Object.assign(initialValue, { [input.key]: 0 })
        break
      case 'Radio':
        Object.assign(initialValue, { [input.key]: false })
        break
      case 'DateTimePicker':
        Object.assign(initialValue, { [input.key]: null })
        break
      case 'DateInput':
        Object.assign(initialValue, { [input.key]: null })
        break
      case 'Checkbox':
        Object.assign(initialValue, { [input.key]: true })
        break
      case 'Chip':
        Object.assign(initialValue, { [input.key]: false })
        break
      default:
        Object.assign(initialValue, { [input.key]: '' })
        break
    }
  })

  if (moreProperties) {
    Object.assign(initialValue, moreProperties)
  }

  return initialValue
}
