/**
 * Helper functions for Developer Documentation Page
 */

import type { ServiceNode } from './types'

export const getArchTypeColor = (type: ServiceNode['type']) => {
  switch (type) {
    case 'frontend': return { bg: 'bg-blue-500', border: 'border-blue-600', text: 'text-blue-800', light: 'bg-blue-50' }
    case 'backend': return { bg: 'bg-green-500', border: 'border-green-600', text: 'text-green-800', light: 'bg-green-50' }
    case 'database': return { bg: 'bg-purple-500', border: 'border-purple-600', text: 'text-purple-800', light: 'bg-purple-50' }
    case 'cache': return { bg: 'bg-cyan-500', border: 'border-cyan-600', text: 'text-cyan-800', light: 'bg-cyan-50' }
    case 'search': return { bg: 'bg-pink-500', border: 'border-pink-600', text: 'text-pink-800', light: 'bg-pink-50' }
    case 'storage': return { bg: 'bg-orange-500', border: 'border-orange-600', text: 'text-orange-800', light: 'bg-orange-50' }
    case 'security': return { bg: 'bg-red-500', border: 'border-red-600', text: 'text-red-800', light: 'bg-red-50' }
    case 'communication': return { bg: 'bg-yellow-500', border: 'border-yellow-600', text: 'text-yellow-800', light: 'bg-yellow-50' }
    case 'ai': return { bg: 'bg-violet-500', border: 'border-violet-600', text: 'text-violet-800', light: 'bg-violet-50' }
    case 'erp': return { bg: 'bg-indigo-500', border: 'border-indigo-600', text: 'text-indigo-800', light: 'bg-indigo-50' }
    default: return { bg: 'bg-gray-500', border: 'border-gray-600', text: 'text-gray-800', light: 'bg-gray-50' }
  }
}

export const getArchTypeLabel = (type: ServiceNode['type']) => {
  switch (type) {
    case 'frontend': return 'Frontend'
    case 'backend': return 'Backend'
    case 'database': return 'Datenbank'
    case 'cache': return 'Cache'
    case 'search': return 'Suche'
    case 'storage': return 'Speicher'
    case 'security': return 'Sicherheit'
    case 'communication': return 'Kommunikation'
    case 'ai': return 'KI/LLM'
    case 'erp': return 'ERP'
    default: return type
  }
}

export const getServiceTypeColor = (type: string) => {
  switch (type) {
    case 'frontend': return 'bg-blue-100 text-blue-800'
    case 'backend': return 'bg-green-100 text-green-800'
    case 'database': return 'bg-purple-100 text-purple-800'
    case 'communication': return 'bg-orange-100 text-orange-800'
    case 'infrastructure': return 'bg-slate-200 text-slate-700'
    default: return 'bg-gray-100 text-gray-800'
  }
}

export const getMethodColor = (method: string) => {
  switch (method) {
    case 'GET': return 'bg-emerald-100 text-emerald-700'
    case 'POST': return 'bg-blue-100 text-blue-700'
    case 'PUT': return 'bg-amber-100 text-amber-700'
    case 'DELETE': return 'bg-red-100 text-red-700'
    default: return 'bg-gray-100 text-gray-700'
  }
}
