import alarm from '@/assets/icons/alarm.svg?raw'
import alertTriangle from '@/assets/icons/alert-triangle.svg?raw'
import bell from '@/assets/icons/bell.svg?raw'
import book2 from '@/assets/icons/book-2.svg?raw'
import books from '@/assets/icons/books.svg?raw'
import building from '@/assets/icons/building.svg?raw'
import bulb from '@/assets/icons/bulb.svg?raw'
import calendar from '@/assets/icons/calendar.svg?raw'
import calendarEvent from '@/assets/icons/calendar-event.svg?raw'
import chartBar from '@/assets/icons/chart-bar.svg?raw'
import chartLine from '@/assets/icons/chart-line.svg?raw'
import circleCheck from '@/assets/icons/circle-check.svg?raw'
import circleX from '@/assets/icons/circle-x.svg?raw'
import clipboardList from '@/assets/icons/clipboard-list.svg?raw'
import clock from '@/assets/icons/clock.svg?raw'
import coin from '@/assets/icons/coin.svg?raw'
import handStop from '@/assets/icons/hand-stop.svg?raw'
import home from '@/assets/icons/home.svg?raw'
import inbox from '@/assets/icons/inbox.svg?raw'
import infoCircle from '@/assets/icons/info-circle.svg?raw'
import lock from '@/assets/icons/lock.svg?raw'
import logout from '@/assets/icons/logout.svg?raw'
import mapPin from '@/assets/icons/map-pin.svg?raw'
import messageCircle from '@/assets/icons/message-circle.svg?raw'
import moodNeutral from '@/assets/icons/mood-neutral.svg?raw'
import robot from '@/assets/icons/robot.svg?raw'
import search from '@/assets/icons/search.svg?raw'
import shield from '@/assets/icons/shield.svg?raw'
import sparkles from '@/assets/icons/sparkles.svg?raw'
import star from '@/assets/icons/star.svg?raw'
import stopwatch from '@/assets/icons/stopwatch.svg?raw'
import thumbDown from '@/assets/icons/thumb-down.svg?raw'
import thumbUp from '@/assets/icons/thumb-up.svg?raw'
import trophy from '@/assets/icons/trophy.svg?raw'
import user from '@/assets/icons/user.svg?raw'
import users from '@/assets/icons/users.svg?raw'
import world from '@/assets/icons/world.svg?raw'

export const iconSvgs = {
  alarm,
  'alert-triangle': alertTriangle,
  bell,
  'book-2': book2,
  books,
  building,
  bulb,
  calendar,
  'calendar-event': calendarEvent,
  'chart-bar': chartBar,
  'chart-line': chartLine,
  'circle-check': circleCheck,
  'circle-x': circleX,
  'clipboard-list': clipboardList,
  clock,
  coin,
  'hand-stop': handStop,
  home,
  inbox,
  'info-circle': infoCircle,
  lock,
  logout,
  'map-pin': mapPin,
  'message-circle': messageCircle,
  'mood-neutral': moodNeutral,
  robot,
  search,
  shield,
  sparkles,
  star,
  stopwatch,
  'thumb-down': thumbDown,
  'thumb-up': thumbUp,
  trophy,
  user,
  users,
  world,
} as const

export type IconName = keyof typeof iconSvgs

export const emojiToIcon: Record<string, IconName> = {
  '⏰': 'alarm',
  '⚠️': 'alert-triangle',
  '🔔': 'bell',
  '📖': 'book-2',
  '📚': 'books',
  '🏛': 'building',
  '💡': 'bulb',
  '📅': 'calendar',
  '🗓️': 'calendar-event',
  '📊': 'chart-bar',
  '📈': 'chart-line',
  '✅': 'circle-check',
  '❌': 'circle-x',
  '📋': 'clipboard-list',
  '⏱': 'stopwatch',
  '⏱️': 'stopwatch',
  '🕒': 'clock',
  '💰': 'coin',
  '👋': 'hand-stop',
  '🏠': 'home',
  '📭': 'inbox',
  ℹ️: 'info-circle',
  '🔒': 'lock',
  '🚪': 'logout',
  '📍': 'map-pin',
  '💬': 'message-circle',
  '😐': 'mood-neutral',
  '🤖': 'robot',
  '🔍': 'search',
  '🛡️': 'shield',
  '✨': 'sparkles',
  '⭐': 'star',
  '👍': 'thumb-up',
  '👎': 'thumb-down',
  '🏆': 'trophy',
  '👤': 'user',
  '👥': 'users',
  '🌍': 'world',
  '🌐': 'world',
} as const

export function normalizeIconName(input?: string | null): IconName | undefined {
  if (!input) return undefined
  if (input in iconSvgs) return input as IconName
  return emojiToIcon[input]
}
