// import http from '@/utils/http'
import type { CreatePo, GetPhoneParams, LoginParams, MusicFInd, TypeList } from '@/types/home'
import { http } from '@/utils/http'

//首页轮播图路径
const home = '/home/banner'

//首页音乐类型路径
const musicType = '/type/find'
//查询具体的音乐
const musicFindUrl = '/music/find'

//用户登录
const userLoginUrl = '/user/login'
//获取用户手机号
const getUserPhoneUrl = '/user/getPhoneNumber'

//生成海报
const createPosterUrl = '/link/save'

//根据scene 查询传输参数路径
const queryParamsUrl = '/link/check'

//生成订单号
const createOrderUrl = ''
//预支付接口
const payAppointmentUrl = ''

//订单号查询
const queryOrderStatusUrl = ''

export const getHomeApi = (distributionSite = 1) => {
  return http<TypeList[]>({
    method: 'GET',
    url: home,
    data: {
      distributionSite,
    },
  })
}

export const musicTypeApi = () => {
  return http<TypeList[]>({
    method: 'GET',
    url: musicType,
    data: {},
  })
}

export const musicFindApi = (id: string) => {
  return http<MusicFInd[]>({
    method: 'GET',
    url: musicFindUrl + `/${id}`,
  })
}

//用户登录
export const userLoginApi = (val: LoginParams) => {
  return http<any>({
    method: 'POST',
    url: userLoginUrl,
    data: { ...val },
  })
}

//获取用户手机号
export const getUserPhoneApi = (val: GetPhoneParams) => {
  return http<any>({
    method: 'POST',
    url: getUserPhoneUrl,
    data: { ...val },
  })
}

//生成海报接口
export const createPosterApi = (val: CreatePo) => {
  return http<any>({
    method: 'POST',
    url: createPosterUrl,
    data: { ...val },
  })
}

//根据查询scene 查询传输参数的 方法
export const queryParamsApi = (val: any) => {
  return http<any>({
    method: 'GET',
    url: `${queryParamsUrl}/${val.scene}/${val.userId}`,
    // data: { ...val },
  })
}

//生成订单号
export const createOrderApi = (val: any) => {
  return http<any>({
    method: 'POST',
    url: createOrderUrl,
    data: { ...val },
  })
}

//调用后去后台核心参数--预支付
export const payAppointmentApi = (val: any) => {
  return http<any>({
    method: 'POST',
    url: payAppointmentUrl,
    data: { ...val },
  })
}

//根据订单号查询用户订单状况
export const queryOrderStatusApi = (val: any) => {
  return http<any>({
    method: 'POST',
    url: queryOrderStatusUrl,
    data: { ...val },
  })
}
