export const API_BASE = process.env.NEXT_PUBLIC_KLAUSUR_SERVICE_URL || 'http://localhost:8086'

export interface Email {
  id: string
  accountId: string
  accountEmail: string
  messageId: string
  subject: string
  senderName: string
  senderEmail: string
  recipients: string[]
  date: string
  bodyPreview: string
  bodyHtml?: string
  bodyText?: string
  isRead: boolean
  hasAttachments: boolean
  attachmentCount: number
  senderType?: string
  category?: string
  priority?: string
  deadlines?: Deadline[]
  aiAnalyzed: boolean
}

export interface Deadline {
  date: string
  description: string
  isFirm: boolean
  confidence: number
}

export interface Account {
  id: string
  email: string
  displayName: string
  unreadCount: number
}

export interface Folder {
  name: string
  icon: JSX.Element
  count?: number
}

export const FOLDER_LABELS: Record<string, string> = {
  inbox: 'Posteingang',
  unread: 'Ungelesen',
  tasks: 'Aufgaben',
  sent: 'Gesendet',
}

export const PRIORITY_COLORS: Record<string, string> = {
  urgent: 'bg-red-500',
  high: 'bg-orange-500',
  medium: 'bg-yellow-500',
  low: 'bg-green-500',
}

export const SENDER_TYPE_SHORT_LABELS: Record<string, string> = {
  kultusministerium: 'MK',
  landesschulbehoerde: 'NLSchB',
  rlsb: 'RLSB',
  nibis: 'NiBiS',
  schulamt: 'Schulamt',
}

export const SENDER_TYPE_LABELS: Record<string, { label: string; color: string }> = {
  kultusministerium: { label: 'Kultusministerium', color: 'bg-purple-100 text-purple-800' },
  landesschulbehoerde: { label: 'Landesschulbehörde', color: 'bg-blue-100 text-blue-800' },
  rlsb: { label: 'RLSB', color: 'bg-indigo-100 text-indigo-800' },
  nibis: { label: 'NiBiS', color: 'bg-cyan-100 text-cyan-800' },
  schulamt: { label: 'Schulamt', color: 'bg-teal-100 text-teal-800' },
  elternvertreter: { label: 'Elternvertreter', color: 'bg-green-100 text-green-800' },
  privatperson: { label: 'Privatperson', color: 'bg-slate-100 text-slate-800' },
}

export const CATEGORY_LABELS: Record<string, string> = {
  dienstlich: 'Dienstlich',
  personal: 'Personal',
  finanzen: 'Finanzen',
  eltern: 'Eltern',
  schueler: 'Schüler',
  fortbildung: 'Fortbildung',
  veranstaltung: 'Veranstaltung',
  sicherheit: 'Sicherheit',
  newsletter: 'Newsletter',
}
