import { getCurrentInstance } from "vue";
export default function useGetStatusIcon() {
  const instance = getCurrentInstance();
  const $liveStatusObj =
    instance.appContext.config.globalProperties.$liveStatusObj;
  const liveStatusObj = {
    1: require("@/assets/images/live-status1.gif"), // 直播中
    2: require("@/assets/images/live-status2.png"), // 未开始
    3: require("@/assets/images/live-status3.png"), // 暂停中
    4: require("@/assets/images/live-status4.png"), // 已结束
    5: require("@/assets/images/live-status5.png"), // 精彩回放
  };

  const liveStatusObj2 = {
    1: require("@/assets/images/playStatus/playStatus1.png"), // 直播中
    2: require("@/assets/images/playStatus/playStatus2.png"), // 未开始
    3: require("@/assets/images/playStatus/playStatus1.png"), // 暂停中
    4: require("@/assets/images/playStatus/playStatus3.png"), // 已结束
  };

  const getStatusIcon = (item, type = 1) => {
    if (type === 2) {
      return liveStatusObj2[item.liveStatus];
    } else {
      return liveStatusObj[
        item.liveStatus === $liveStatusObj.FinishPlay &&
        item.libraryList &&
        item.libraryList.length
          ? 5
          : item.liveStatus
      ];
    }
  };
  return getStatusIcon;
}
