// Oil English names map
const OIL_EN = {
  '薰衣草': 'Lavender', '茶树': 'Tea Tree', '乳香': 'Frankincense',
  '柠檬': 'Lemon', '椒样薄荷': 'Peppermint', '丝柏': 'Cypress',
  '尤加利': 'Eucalyptus', '迷迭香': 'Rosemary', '天竺葵': 'Geranium',
  '依兰依兰': 'Ylang Ylang', '佛手柑': 'Bergamot', '生姜': 'Ginger',
  '没药': 'Myrrh', '檀香': 'Sandalwood', '雪松': 'Cedarwood',
  '罗马洋甘菊': 'Roman Chamomile', '永久花': 'Helichrysum',
  '快乐鼠尾草': 'Clary Sage', '广藿香': 'Patchouli',
  '百里香': 'Thyme', '牛至': 'Oregano', '冬青': 'Wintergreen',
  '肉桂': 'Cinnamon', '丁香': 'Clove', '黑胡椒': 'Black Pepper',
  '葡萄柚': 'Grapefruit', '橙花': 'Neroli', '玫瑰': 'Rose',
  '岩兰草': 'Vetiver', '马郁兰': 'Marjoram', '芫荽': 'Coriander',
  '柠檬草': 'Lemongrass', '杜松浆果': 'Juniper Berry', '甜橙': 'Wild Orange',
  '香茅': 'Citronella', '薄荷': 'Peppermint', '扁柏': 'Arborvitae',
  '古巴香脂': 'Copaiba', '椰子油': 'Coconut Oil',
  '芳香调理': 'AromaTouch', '保卫复方': 'On Guard', '保卫': 'On Guard',
  '乐活复方': 'Balance', '乐活': 'DigestZen',
  '舒缓复方': 'Past Tense', '舒缓': 'Deep Blue',
  '净化复方': 'Purify', '净化清新': 'Purify',
  '呼吸复方': 'Breathe', '顺畅呼吸': 'Breathe',
  '舒压复方': 'Adaptiv', '安定情绪': 'Balance',
  '安宁神气': 'Serenity', '多特瑞': 'doTERRA',
  '野橘': 'Wild Orange', '柑橘清新': 'Citrus Bliss',
  '新瑞活力': 'MetaPWR', '元气': 'Zendocrine',
  '温柔呵护': 'ClaryCalm', '西洋蓍草': 'Yarrow|Pom',
  '西班牙牛至': 'Oregano',
}

export function oilEn(name) {
  if (OIL_EN[name]) return OIL_EN[name]
  // Try without common suffixes
  const base = name.replace(/复方$|呵护$/, '')
  if (base !== name && OIL_EN[base]) return OIL_EN[base]
  // Try adding suffixes
  if (OIL_EN[name + '复方']) return OIL_EN[name + '复方']
  return ''
}

export function recipeNameEn(name) {
  // Try to translate known keywords
  // Simple approach: return original name for now, user can customize
  return name
}

// Custom translations (can be set by admin)
const customTranslations = {}

export function setCustomTranslation(zhName, enName) {
  customTranslations[zhName] = enName
}

export function getCustomTranslation(zhName) {
  return customTranslations[zhName]
}
