export const vibrationMetricOptions = [
  { field: 'vibrationSpeed', label: '振动速度', unit: 'mm/s', color: '#f59e0b' },
  { field: 'vibrationDisplacement', label: '振动位移', unit: 'um', color: '#5b8ff9' },
  { field: 'vibrationAcceleration', label: '振动加速度', unit: 'g', color: '#36cfc9' },
  { field: 'vibrationTemp', label: '振动温度', unit: '℃', color: '#f56c6c' }
] as const;

export const formatDateTime = (date: Date) => {
  const p = (n: number) => n.toString().padStart(2, '0');
  return `${date.getFullYear()}-${p(date.getMonth() + 1)}-${p(date.getDate())} ${p(date.getHours())}:${p(date.getMinutes())}:${p(date.getSeconds())}`;
};

export const createDefaultTimeRange = () => {
  const end = new Date();
  const start = new Date(end.getTime() - 24 * 3600 * 1000);
  return [formatDateTime(start), formatDateTime(end)];
};
