import { logClick, logExposure, MDAuto } from "@grace/built-in";
import { IAutoMdData } from "@grace/built-in";
import { getUrlParam } from "@/utils/utils.ts";

const appId = CFG.appID;
const dcm = "202." + CFG.projectId + ".0.0";
const domain = "";

const MDList: IAutoMdData[] = new Array(13).fill("").map((_, i) => {
  return {
    ele: `.md${i + 1}`,
    data: {
      dpm: `${appId}.110.${i + 1}.1`,
      dcm,
      domain,
      appId,
    },
    once: false,
  };
});


MDAuto({
  show: MDList, // 曝光
  click: MDList, // 点击
});

export function handleLogExposure(id: number | string, id2: number | string = 1) {
  logExposure({
    dpm: `${appId}.110.${id}.${id2}`,
    dcm,
    domain,
    appId,
  });
}

export function handleLogClick(id: number | string, id2: number | string = 1) {
  logClick({
    dpm: `${appId}.110.${id}.${id2}`,
    dcm,
    domain,
    appId,
  });
}


export function handleTaskLogClick(id, id2 = 1, btnStatus) {
  logClick({
    dpm: `${appId}.110.${id}.${id2}`,
    dcm: `202.${CFG.projectId}.0.${btnStatus}'`,
    domain,
    appId,
  });
}
export function handleTaskLogExposure(id, id2 = 1, btnStatus) {
  logExposure({
    dpm: `${appId}.110.${id}.${id2}`,
    dcm: `202.${CFG.projectId}.0.${btnStatus}'`,
    domain,
    appId,
  });
}