import { v4 as uuidv4 } from 'uuid'

import { ModuleInitParams } from './types'
import {
  TalentModuleMixItem,
  TalentProfileModule
} from '../../models/talent/talent-profile-module.model'

export function createModule({
  type,
  groupId,
  data,
  order,
  name
}: ModuleInitParams): TalentProfileModule<TalentModuleMixItem> {
  return {
    id: uuidv4(),
    order,
    name,
    type: type,
    items: [],
    expand: true,
    visible: true,
    isEdit: false,
    isCreate: true,
    isLoading: false,
    groupId,
    showTitle: true,
    ...data
  }
}
