import { getUniversityType, getRegionInfo, getNature } from '@/service/index/api'

interface Region {
  code: string
  name: string
  parentcode: string
  simplename: string
  pinyin: string
}
export const useRegionInfo = () => {
  const regionList = ref<any[]>([])
  getRegionInfo().then((res) => {
    if (res.code === 200) {
      regionList.value = res.result as Region[]
    }
  })

  return { regionList }
}

export const useUniversityType = () => {
  const typeList = ref<any[]>([])
  getUniversityType().then((res) => {
    if (res.code === 200) {
      typeList.value = res.result as { id: number; name: string }[]
    }
  })

  return { typeList }
}

export const useNatureList = () => {
  const natureList = ref<any[]>([])
  getNature().then((res) => {
    if (res.code === 200) {
      natureList.value = res.result as { id: number; name: string }[]
    }
  })

  return { natureList }
}
