export function getPlaceholderMessage(reason: string | undefined) {
  if (reason === 'brand_zero_hit_stop') {
    return '品牌命中率为 0%，已停止后续搜索';
  }

  if (reason === 'captcha_intercept') {
    return '历史记录：1688 滑块验证未通过，当时已跳过当前阶段';
  }

  if (reason === 'round_failed') {
    return '当前阶段执行失败，已跳过';
  }

  return '该阶段没有可展示的商家结果';
}

export function getShortageMessage(reason: string | undefined) {
  if (reason === 'insufficient_source_candidates') {
    return '原始候选商家不足目标数';
  }

  if (reason === 'contact_navigation_failed') {
    return '联系方式页导航失败';
  }

  if (reason === 'source_exhausted_before_target') {
    return '候选商家已耗尽仍未达到目标';
  }

  if (reason === 'llm_batch_failed') {
    return 'glm-4-plus 离线 Batch 商品匹配失败';
  }

  if (reason === 'matched_candidates_exhausted_or_valid_phone_insufficient') {
    return 'LLM 匹配候选耗尽或有效电话不足';
  }

  if (reason === 'no_search_candidates') {
    return '没有搜索候选商品';
  }

  return reason || '';
}

export function formatStageSkipReason(reason: string | undefined) {
  if (!reason) {
    return '';
  }

  if (reason === 'brand_zero_hit_stop') {
    return '品牌命中率为 0%，已停止后续搜索';
  }

  if (reason === 'captcha_intercept') {
    return '历史记录：1688 滑块验证未通过，当时已跳过当前阶段';
  }

  if (reason === 'round_failed') {
    return '当前阶段执行失败，已跳过';
  }

  return reason;
}
