import {
  transToDimensionsAndMetrics,
  transformDataResult,
  checkDataConfig,
} from "@/CustomElement/tool";
import { SHUFFLTABLE, GROUPLINE } from "@bdlite/chart-config/lib/chartTypes.js";
import tableData from "./data/tableData";
import lineBarData from "./data/lineBarData";
import groupLineData from "./data/groupLineData";

import {
  tableSuccessDataConfig,
  tableErrorDataConfig,
} from "./dataConfig/table";

import {
  groupLineSuccessDataConfig,
  groupLineErrorDataConfigDimension,
  groupLineErrorDataConfigMetric,
} from "./dataConfig/groupLineDataConfig";

console.log("====> 解析接口field/dimensions字段，按照维度和度量划分 <======");
console.log("table", transToDimensionsAndMetrics(tableData.data));
console.log("linebar", transToDimensionsAndMetrics(lineBarData.data));
console.log("groupLine", transToDimensionsAndMetrics(groupLineData.data));

console.log("====> 转换数据 <======");
console.log("table", transformDataResult(tableData.data));
console.log("linebar", transformDataResult(lineBarData.data));
console.log("groupLine", transformDataResult(groupLineData.data));

console.log("====> 检查dataConfig是否合法 <======");
console.log(
  "success table data config",
  checkDataConfig(SHUFFLTABLE, tableSuccessDataConfig)
);
console.log(
  "fail table data config",
  checkDataConfig(SHUFFLTABLE, tableErrorDataConfig)
);

console.log(
  "success GROUPLINE data config",
  checkDataConfig(GROUPLINE, groupLineSuccessDataConfig)
);
console.log(
  "fail GROUPLINE data config Dimension",
  checkDataConfig(GROUPLINE, groupLineErrorDataConfigDimension)
);
console.log(
  "fail GROUPLINE data config Metric",
  checkDataConfig(GROUPLINE, groupLineErrorDataConfigMetric)
);
