import {
  iGetList,
  iExportTable
} from '@/api/baby'

import listResult from '@/model/listResult'

const getList = async data => listResult(await iGetList(data), x => ({
  id: x.accountId,
  nickName: x.nickname,
  mobile: x.mobileNumber,
  baby: x.babyList.map(y => ({
    name: y.name,
    gender: y.gender === 0 ? '-' : y.gender === 1 ? '男' : '女',
    birthday: y.birthday
  }))
}))

const exportTable = async params => await iExportTable(params)

export {
  getList,
  exportTable
}
