/**staticData */
import moment from 'moment';

interface DataItem {
  [field: string]: string | number | number[] | null | undefined;
}

/**设备数据 */
let equipData: DataItem[] = [];
const beginDay = new Date().getTime();

const fakeY = [7, 5, 4, 2, 4, 7, 5, 6, 5, 9, 6, 3, 1, 5, 3, 6, 5];
for (let i = 0; i < fakeY.length; i += 1) {
  equipData.push({
    x: moment(new Date(beginDay + 1000 * 60 * 60 * 24 * i)).format('YYYY-MM-DD'),
    y: fakeY[i],
  });
}

/**违规数据 */
const offendingData: Record<string, any>[] = [];
for (let i = 0; i < 12; i += 1) {
  offendingData.push({
    x: `${i + 1}月`,
    y: Math.floor(Math.random() * 1000) + 200,
  });
}

/**排名数据 */
function generateRandomArray(length: number, min: number, max: number): number[] {
  const randomArray: number[] = [];
  for (let i = 0; i < length; i++) {
    const randomValue = Math.floor(Math.random() * (max - min + 1)) + min;
    randomArray.push(randomValue);
  }

  return randomArray;
}
const rankingListData: Record<string, any>[] = [];
for (let i = 0; i < 7; i += 1) {
  rankingListData.push({
    title: `工专路 ${i} 号店`,
    total: generateRandomArray(1, 10000, 20000)[0],
  });
}

/**趋势数据 */
// const trendData: any[] = [];
const trendData = [1, 6, 4, 8, 3, 7, 2];
// for (let i = 0; i < fakeY2.length; i += 1) {
//   trendData.push({
//     x: moment(new Date(beginDay + 1000 * 60 * 60 * 24 * i)).format('YYYY-MM-DD'),
//     y: fakeY2[i],
//   });
// }

/**类别占比数据 */
const salesTypeData = [
  {
    x: '家用电器',
    y: 4544,
  },
  {
    x: '食用酒水',
    y: 3321,
  },
  {
    x: '个护健康',
    y: 3113,
  },
  {
    x: '服饰箱包',
    y: 2341,
  },
  {
    x: '母婴产品',
    y: 1231,
  },
  {
    x: '其他',
    y: 1231,
  },
];

const salesTypeDataOnline = [
  {
    x: '家用电器',
    y: 244,
  },
  {
    x: '食用酒水',
    y: 321,
  },
  {
    x: '个护健康',
    y: 311,
  },
  {
    x: '服饰箱包',
    y: 41,
  },
  {
    x: '母婴产品',
    y: 121,
  },
  {
    x: '其他',
    y: 111,
  },
];

const salesTypeDataOffline = [
  {
    x: '家用电器',
    y: 99,
  },
  {
    x: '食用酒水',
    y: 188,
  },
  {
    x: '个护健康',
    y: 344,
  },
  {
    x: '服饰箱包',
    y: 255,
  },
  {
    x: '其他',
    y: 65,
  },
];
export default {
  equipData,
  offendingData,
  rankingListData,
  trendData,
  salesTypeData,
  salesTypeDataOnline,
  salesTypeDataOffline
};
