import { pushPanel } from "../actions/panelActions";
import { panel_names } from "../utils/Config";

//V2_진입경로코드_진입경로명_MT_노출순번
export const handleDeepLink = (contentTarget) => (dispatch, getState) => {
  const tokens = contentTarget.split("_");
  if (tokens[0] === "V2") {
    const linkTpCd = tokens[1]; // 진입경로코드
    const linkTpName = tokens[1]; // 진입경로명
    const type = tokens[3]; // 링크 타입.
    let panelName = "";
    let panelInfo = {};
    switch (type) {
      case "LS":
        break;
      case "PD":
        break;
      case "SD":
        break;
      case "MA":
        break;
      case "TD":
        break;
      case "OS":
        panelName = panel_names.ON_SALE_PANEL;
        break;
      case "HP":
        break;
      case "HD":
        break;
      case "APD":
        break;
      case "AMD":
        break;
      case "ATD":
        break;
      case "ASD":
        break;
      case "TO":
        break;
      case "PS":
        break;
      case "SC":
        break;
    }
    if (panelName) {
      console.log("handleDeepLink - panelName", panelName, panelInfo);
      dispatch(pushPanel({ name: panelName, panelInfo }));
      //todo deeplink log
    }
  } else {
    console.log("handleDeepLink - no target");
  }
};
