const transformColumns = (columns) =>
  columns.map((col) => ({
    ...col,
    dataIndex: col.key,
    width: col.width ?? 120,
    align: "center",
  }));

const MONTHCOLUMNS = transformColumns([
  { title: "項目", key: "item", width: 190, fixed: true },
  { title: "1月", key: "January" },
  { title: "2月", key: "February" },
  { title: "3月", key: "March" },
  { title: "4月", key: "April" },
  { title: "5月", key: "May" },
  { title: "6月", key: "June" },
  { title: "7月", key: "July" },
  { title: "8月", key: "August" },
  { title: "9月", key: "September" },
  { title: "10月", key: "October" },
  { title: "11月", key: "November" },
  { title: "12月", key: "December" },
]);

const WORKHOURSROW = [
  {
    key: "Index",
    item: "月份",
  },
  {
    key: "WorkerNumber",
    item: "員工數",
  },
  {
    key: "WorkDay",
    item: "每日每人平均工作時數",
  },
  {
    key: "Scalar",
    item: "總工時",
  },
  {
    key: "OverTimeWorkerNumber",
    item: "加班員工數",
  },
  {
    key: "OverTimeAverageHourPerDay",
    item: "每日每人平均加班時數",
  },
  {
    key: "OverTimeWorkDay",
    item: "月加班工作天數",
  },
  {
    key: "OverTimeScalar",
    item: "月合計加班時數",
  },
  { key: "TotalHours", item: "總工時", readonly: true },
  { key: "KgCO2e", item: "KgCO2e", readonly: true },
  { key: "Description", item: "描述/說明" },
  {
    item: "使用量佐證文件",
    key: "ReferenceFileLink",
  },
];

const ELECTRICROW = transformColumns([
  {
    key: "Index",
    title: "月份",
  },
  {
    key: "Peak",
    title: "尖峰 / 峰",
  },
  {
    key: "HalfPeak",
    title: "半尖峰 / 平",
  },
  {
    key: "SaturdayHalfPeak",
    title: "週六半尖峰",
  },
  {
    key: "OffPeak",
    title: "離峰 / 谷",
  },
  {
    key: "KgCO2e",
    title: "碳排放 KgCO2e",
  },
  // {
  //   key: "Elecdeduct1",
  //   item: "電力扣除額1",
  // },
  // {
  //   key: "Elecdeduct2",
  //   item: "電力扣除額2",
  // },
  // {
  //   key: "Scalar",
  //   item: "總用電量",
  // },
  // { key: "Description", item: "描述/說明" },
  // { key: "KgCO2e", item: "KgCO2e", readonly: true },
  // {
  //   item: "使用量佐證文件",
  //   key: "ReferenceFileLink",
  // },
]);

const REFRIGERANTCOLUMNS = transformColumns([
  { title: "廠區 / 製程別", key: "ProcessName" },
  { title: "負責單位", key: "ResponsibleUnit" },
  { title: "設備名稱", key: "Name" },
  { title: "型號", key: "ModelNumber" },
  { title: "使用冷媒 / 製冷劑種類	", key: "ParameterIDTitle" },
  { title: "全廠台數", key: "TotalNumber" },
  { title: "冷媒 / 製冷劑原始填充量(Kg)	", key: "Scalar" },
  { title: "使用月數", key: "UsedMonth" },
  { title: "設備類型(排放因子)	", key: "ParameterID2Title" },
  { title: "GWP", key: "GWP" },
  { title: "設備逸散率", key: "factor" },
  { title: "KgCO2e", key: "KgCO2e" },
]);

export { MONTHCOLUMNS, WORKHOURSROW, ELECTRICROW, REFRIGERANTCOLUMNS };
