import request from '@/utils/request'

// 查询混音歌曲列表
export function listRemixSong(query) {
  return request({
    url: '/back/music/list',
    method: 'get',
    params: query
  })
}

// 查询混音歌曲详细
export function getRemixSong(id) {
  return request({
    url: '/back/music/list',
    method: 'get',
    params: {
      musicType: 'mixing',
      musicId: id
    }
  })
}

// 获取音乐列表（用于选择场景音乐）
export function getMusicList(query) {
  return request({
    url: '/back/music/list',
    method: 'get',
    params: query
  })
}

// 新增混音歌曲
export function addRemixSong(data) {
  return request({
    url: '/back/music/add/mixMusic',
    method: 'post',
    data: {
      musicId: data.musicId,
      sceneIds: data.sceneIds,
      sceneJson: data.sceneJson,
      // 添加其他表单字段
      name: data.name,
      author: data.author,
      vip: data.vip,
      shelf: data.shelf,
      imgAddr: data.imgAddr,
      musicType: data.musicType,
      label: data.label
    },
    headers: {
      'Content-Type': 'application/json'
    }
  })
}

// 修改混音歌曲
export function updateRemixSong(data) {
  return request({
    url: '/back/music/edit/mixMusic',
    method: 'post',
    data: {
      id: data.id,
      musicId: data.musicId,
      sourceMusicId: data.sourceMusicId,
      sceneIds: data.sceneIds,
      sceneJson: data.sceneJson,
      // 添加其他表单字段
      name: data.name,
      author: data.author,
      vip: data.vip,
      shelf: data.shelf,
      imgAddr: data.imgAddr,
      musicType: data.musicType,
      label: data.label
    },
    headers: {
      'Content-Type': 'application/json'
    }
  })
}

// 删除混音歌曲
export function delRemixSong(id) {
  return request({
    url: '/back/music/' + id,
    method: 'delete'
  })
}
