const RESERVED_NICKNAME_KEYWORDS = [
  'admin',
  'administrator',
  'operator',
  'owner',
  'master',
  'staff',
  'system',
  'root',
  'support',
  'manager',
  'mod',
  'moderator',
  'official',
  'service',
  'team',
  'zenn',
  '운영자',
  '관리자',
  '오너',
  '마스터',
  '스태프',
  '시스템',
  '루트',
  '서포트',
  '매니저',
  '모더레이터',
  '공식',
]

function normalizeNickname(value) {
  return String(value || '')
    .trim()
    .toLowerCase()
    .replace(/\s+/g, '')
}

function isReservedNickname(value) {
  const normalized = normalizeNickname(value)
  if (!normalized) return false
  return RESERVED_NICKNAME_KEYWORDS.some((keyword) => normalized.includes(normalizeNickname(keyword)))
}

module.exports = {
  RESERVED_NICKNAME_KEYWORDS,
  normalizeNickname,
  isReservedNickname,
}
