export function parseDuration(input: string): number {
  const m = input.match(/^(\d+)([smhd])$/i);
  if (!m) {
    throw new Error('Duration must be like 30m, 12h, 7d');
  }
  const amount = Number(m[1]);
  const unit = m[2].toLowerCase();
  const factor = unit === 's' ? 1000 : unit === 'm' ? 60000 : unit === 'h' ? 3600000 : 86400000;
  return amount * factor;
}
