import { http } from '@/utils/http'

export interface IFooItem {
  id: string
  name: string
}

export const sysDictType = (params: any) => {
  return http.get('/api/sysDictData/dicStatus', params)
}

export const getProvinceInitialization = () => {
  return http.get('/api/busProvinceInitialization/list')
}

export const getCountryRules = () => {
  return http.get('/api/v1/base/rules.json', { staticType: 'static' })
}

export const getUnSortType = () => {
  return http.get('/api/v1/base/un_sort_type.json', { staticType: 'static' })
}

export const getUniversityLevel = () => {
  return http.get('/api/v1/base/un_level.json', { staticType: 'static' })
}

export const getUniversityFeature = () => {
  return http.get('/api/v1/base/features.json', { staticType: 'static' })
}

export const getRegionInfo = () => {
  return http.get('/api/v1/base/regions.json', { staticType: 'static' })
}

export const getUniversityType = () => {
  return http.get('/api/v1/base/universitytype.json', { staticType: 'static' })
}

// 获取办学性质
export const getNature = () => {
  return http.get('/api/v1/base/nature.json', { staticType: 'static' })
}

export const getUniversityRank = (params: {
  Type: number
  Year?: number
  Name?: string
  PageIndex: number
  PageSize: number
}) => {
  return http.get('/api/zhiYuan/universityRank', { ...params })
}

export const getNewsTop = (params: { Top: number; CategoryId: number; provinceCode: string }) => {
  return http.get('/api/ZyNews/top', params)
}

export const getNewsDetailInfo = (params: { id: number }) => {
  return http.get('/api/ZyNews/detail', params)
}

export const getNewsList = (params: {
  CategoryId: number
  provinceCode: string
  PageIndex: number
  PageSize: number
}) => {
  return http.get('/api/ZyNews/newsPage', params)
}

export const getSessionKey = (params: { JsCode: string }) => {
  return http.get('/api/sysWxOpen/wxOpenId', params)
}

export const setWxInfo = (params: { code: string; openId: string }) => {
  return http.get('/api/sysWxOpen/wxPhone', params)
}

export const getWxUserInfo = () => {
  return http.get('/api/weChatUserEx/userInfo')
}

export const getVolunteerInitialization = () => {
  return http.get('/api/v1/base/volunteerInitialization.json', { staticType: 'static' })
}

export const getUniversityList = (params: {
  pageIndex: number
  pageSize: number
  name?: string
  provinceName?: string[]
  utype?: string[]
  nature?: string[]
}) => {
  return http.post('/api/zhiYuan/university', params)
}

// 获取大学信息
export const getUniversityInfo = (params: { Id: number }) => {
  return http.get('/api/zhiYuan/universityDetail', params)
}

// 获取双一流学科
export const getSubjectIntroduceList = (id: number) => {
  return http.get('/api/zhiYuan/subjectIntroducelist', { id })
}

// 院校
export const getUniversityListByProvince = (params: { id: number }) => {
  return http.get('/api/zhiYuan/zfacultylist', params)
}

export const getPlanProList = (params: {
  _uid: number
  years: string
  batchName: string
  locationCode: string
}) => {
  return http.get('/api/PlanPro/v2/list', params)
}

export const getRecruits = (uid: number) => {
  return http.get('/api/zhiYuan/recruits', { uid })
}

export const getRecruitsDetail = (params: { id: number }) => {
  return http.get('/api/zhiYuan/recruitdetail', params)
}

export const addUnCollection = (params: { wxId: number; uId: number }) => {
  return http.post('/api/unCollection/add', params)
}

export const getUnCollectionList = (params: {
  SearchKey: string
  Page?: number
  PageSize?: number
}) => {
  //获取用户院校收藏表列表
  return http.get('/api/unCollection/list', params)
}

export const getUnCollectionDetail = (params: { Id: number }) => {
  return http.get('/api/unCollection/detail', params)
}

export const getMajorLevelList = (params: { Type: number; KeyWord: string }) => {
  return http.get(`/api/zhiYuan/majors`, params)
}

export const getAdmissionMark = (params: {
  _uid: number
  years: string
  batchName: string
  locationCode: string
}) => {
  return http.get('/api/PlanPro/admissionMarkV2', params)
}

export const deleteUnCollection = (params: { wxId: number; uId: number }) => {
  return http.post('/api/unCollection/delete', params)
}

export const getMajorDetail = (params: { SpecId: string }) => {
  return http.get('/api/zhiYuan/majorDetail', params)
}

export const getMajorCourse = (params: { SpecId: string }) => {
  return http.get('/api/zhiYuan/zkskcMajor', params)
}

// 专业关联院校
export const getMajorUniversityList = (params: { SpecId: string }) => {
  return http.get('/api/zhiYuan/zksyxMajor', params)
}

export const getCareerProspects = (params: { zydm: string }) => {
  return http.get('/api/zhiYuan/careerProspects', params)
}

// 职业方向
export const getBaseProfession = (params: { KeyWord: string }) => {
  return http.get('/api/zhiYuan/baseProfession', params)
}
export const getProfessionInfo = (params: { id: string }) => {
  return http.get('/api/zhiYuan/professiondetails', params)
}

export const getBatchList = (params: { locationCode: string; year: string; type: string }) => {
  return http.get('/api/zhiYuan/batchList', params)
}

export const getScoreSection = (params: {
  locationCode: string
  year: string
  type: string
  Score: string | number
}) => {
  return http.get('/api/ScoreSection/scoreSection/V2', params)
}

export const verifyUniversity = (params: { keyword: string; provinceName: string }) => {
  return http.get('/api/zhiYuan/fackUniversitys', params)
}

export const getUserCity = (params: { lat: number; lng: number }) => {
  return http.get('/api/location/getcity', {
    ...params,
  })
}

export const savePerfectInfo = (params: {
  provinceCode?: string
  provinceName?: string
  schoolName?: string
  className?: string
  subjectGroup?: string
  score?: number
  sp?: number
  year?: number
  sex?: number
  nickName?: string
  inviteCode?: string
}) => {
  return http.post('/api/weChatUserEx/perfectInfo', params)
}

export const getBatchData = (url: string) => {
  return http.get(url, { haPrefix: true })
}

export interface filterParams {
  batchName?: null | string
  feature?: string[] | null
  keyword?: null | string
  locationCode?: null | string
  majors?: string[] | null
  nature?: string[] | null
  ownership?: string[] | null
  pageIndex?: number
  pageSize?: number
  province?: string[] | null
  subjects?: string[] | null
  universityName?: null | string
}
export const getFilterData = (params: filterParams) => {
  return http.get('/api/PlanPro/planList', params)
}

export interface AutoFillParams {
  batchName?: null | string
  endscore?: number | null
  feature?: string[] | null
  keyword?: null | string
  location?: null | string
  majors?: string[] | null
  nature?: string[] | null
  utype?: string[] | null
  ownership?: string[] | null
  p?: number | null
  pageIndex?: number
  pageSize?: number
  province?: string[] | null
  score?: number | null
  startscore?: number | null
  subjects?: string[] | null
  subjectType?: string[] | null
  type?: number | null
  secondmajor?: string[]
}
export const getUniversityListByFilter = (params: AutoFillParams) => {
  return http.post('/api/PlanPro/v2/oneKey', params)
}

export const aiPreview = (params: {
  location: string
  p: number
  score: string | number
  subjects: string[]
}) => {
  return http.post('/api/PlanPro/aiPerview', params)
}

export const getPlanProListByFilter = (params: AutoFillParams) => {
  return http.post('/api/PlanPro/aiUniversity', params)
}

export const getBatchBase = (params: { locationCode: string }) => {
  return http.get('/api/busBatchBase/batch', params)
}

type WishListParams = {
  vId?: number
  cId: number
  tableName?: string
  batchName: string
  type: string
  subjectClaim: string
  score: number
  LocationCode: string
  vTbDetails: {
    unId: number
    unName: string
    unCode: string
    type: number
    sort: number
    vItems: {
      sort: number
      _pId: number
      major: string
      majorCode: string
      majorGroup: string
      type: number
      percentAge: string
    }[]
  }[]
}
export const saveWishList = (params: WishListParams) => {
  return http.post('/api/volunTb/post', params)
}

export const putWishList = (params: WishListParams) => {
  return http.post('/api/volunTb/put', params)
}

export const getProductionList = (params: { Id: string }) => {
  return http.get('/api/busProduct/detail', params)
}

export const payTransaction = (params: { total: number; openId: string; description: string }) => {
  return http.post('/api/sysWechatPay/payTransaction', params)
}

export const getWishList = (params: { locationCode: string }) => {
  return http.get('/api/volunTb/v2/list', params)
}

export const deleteWishList = (params: { id: number }) => {
  return http.post('/api/volunTb/delete', params)
}

export const activeCard = (params: { cardCode: string; cardPwd: string }) => {
  return http.post('/api/Zyvip/bind', params)
}

export const getBingInfo = () => {
  return http.get('/api/Zyvip/bingInfo')
}

export const getAdmissionTrends = (params: {
  ascription?: string[] | null
  /**
   * 985、211
   */
  feature?: string[] | null
  keyword?: null | string
  /**
   * 本科0专科1
   */
  level?: number | null
  /**
   * 用户所在省份编码
   */
  locationCode?: null | string
  nature?: string[] | null
  pageIndex?: number
  pageSize?: number
  provinceName?: string[] | null
  utype?: string[] | null
}) => {
  return http.post('/api/admissionstreds/university', params)
}

export const getAdmissionTrendsByCollege = (params: {
  uid: number
  year: number
  locationCode: string
}) => {
  return http.get('/api/admissionstreds/major', params)
}

export const getEvaluationList = (params: { menuid: string }) => {
  return http.get('/api/busScale/list', params)
}

export const getAssessmentQuestions = (params: { ScaleId: number }) => {
  return http.get('/api/busScale/getscalequestions', params)
}
export const getBusScaleDescription = (params: { ScaleId: number }) => {
  return http.get('/api/busScale/GetBusScaleDescription', params)
}
export const saveBusScaleAnswer = (params: {
  customId: number
  scaleId: number
  inputs: { type: string; name: string; value: string }[]
}) => {
  return http.post('/api/busScale/CustomBusScale/v2', params)
}

export const getBusSpecialListGroup = (params?: { Code: number }) => {
  return http.get('/api/busSpecialistGroup/list', params)
}

export const addSpecial = (params: {
  openId: string
  sId: number
  appointmentTime: string
  isDelete?: boolean
}) => {
  return http.post('/api/specialistReservation/add', params)
}

export const getMySpecialList = (params: { openId: string }) => {
  return http.get('/api/specialistReservation/reservation', params)
}

export const getMyBusReports = (params: { CustomId: number }) => {
  return http.get('/api/busScale/GetBusCustomReports/v2', params)
}

export const deleteMyAppointment = (params: { id: number }) => {
  return http.post('/api/specialistReservation/delete', params)
}

export const getHollandDimensionInfo = (params: { ScaleId: string }) => {
  return http.get('/api/busScale/GetHollandDimension', params)
}

export const getTagMapPro = (params: { tag: string }) => {
  return http.get('/api/busScale/getTagMapPro', params)
}

export const getTagMapPerson = (params: { tag: string }) => {
  return http.get('/api/busScale/getTagMapPerson', params)
}

export const getMBTIDimension = (params: { ScaleId: number }) => {
  return http.get('/api/busScale/GetMBTIDimension', params)
}

export const getAbilityDimension = (params: { ScaleId: number }) => {
  return http.get('/api/busscale/GetAbilityDimension', params)
}

export const getOpinionAbout = (params: { ScaleId: number }) => {
  return http.get('/api/busScale/GetOpinionAbout', params)
}

export const downloadPDF = (params: { id: number; location: string }) => {
  return http.get('/api/volunTb/downloadpdfUrl', params)
}

export const getBatchDynamicData = (params: { LocationCode: string; Course: string }) => {
  return http.get('/api/busBatchBase/batch', params)
}

export const getCustomScaleExplains = (params: { CustomScaleId: number }) => {
  return http.get('/api/busScale/GetCustomScaleExplains', params)
}

export const sendMessage = (params: { conversation_id: string; user: string; query: string }) => {
  return http.post(
    'https://api.coze.cn/open_api/v2/chat',
    {
      ...params,
      stream: true,
      bot_id: '7456409430717480998',
    },
    { haPrefix: true },
  )
}

export const getAssistant = () => {
  return http.get('/api/weChatUserEx/areaExtend', {})
}

export const verifyInviteCode = ({ code }: { code: string }) => {
  return http.post('/api/weChatUserEx/verifyInviteCode', { code })
}

export const getADBanner = ({ code }: { code: string } = { code: 'b001' }) => {
  return http.get('/api/zhiYuan/banner', { code })
}

export const authQrCode = ({
  userCode,
  messageType,
  weChat,
}: {
  userCode: string
  messageType: number
  weChat: {
    openId: string
    sessionKey: string
    unionId: string
  }
}) => {
  return http.post(
    'https://api.sso.ycymedu.com/api/syswxopen/hookscuess',
    {
      userCode: userCode,
      messageType,
      weChat,
      tpkey: '9k1cbc3f546eda35168c3aa3cb91780fbe703f0996c6d123ea96dc85c70bbc0a',
    },
    { hasPrefix: true },
  )
}
