import request from "./request";
import state from "/src/state";

/** 获取内容平台的曲谱详情 */
// export const getMusicSheetDetail = (sysMusicScoreId: string) => {
//   return request.get("/open/musicSheet/detail/" + sysMusicScoreId, {
//     isContentCenter: true, // 内容平台
//   });
// };

/** 获取内容平台的曲谱详情 */
export const getMusicSheetDetail = (sysMusicScoreId: string, type?: string, musicId?: string) => {
  let url = type === 'open' ? `/open/musicSheet/cbsDetail/${sysMusicScoreId}?userMusicId=${musicId}` : `/musicSheet/cbsDetail/${sysMusicScoreId}`;
  if (state.tenantAlbumId) {
    url += `?tenantAlbumId=${state.tenantAlbumId}`
  }
  if (state.systemType === 'web') {
    url = `/musicSheet/cbsDetail/${sysMusicScoreId}?providerType=${state.providerType}`
  }
  return request.get(url, { noToken: type === 'open' ? true : false });
};

/** 生成图片 */
export const creatMusicSheetImg = (data: any) => {
  return request.post("/open/musicSheet/img", {
    isContentCenter: true, // 内容平台
    data
  });
};