// ============================================================
// LSMD — Stammdaten & Beispieldaten (alles fiktiv, GTA-RP)
// ============================================================

// ---- Ränge / Positionen (mit Farbe) ----
const RANKS = {
  aerztl_direktor: { label: 'Ärztlicher Direktor', color: '#FF4F6C', tier: 5 },
  stellv_direktor: { label: 'Stellv. Direktor',     color: '#CC2233', tier: 5 },
  chefarzt:        { label: 'Chefarzt',             color: '#F59E0B', tier: 4 },
  oberarzt:        { label: 'Oberarzt',             color: '#E0A33A', tier: 4 },
  facharzt:        { label: 'Facharzt',             color: '#3B82F6', tier: 3 },
  assistenzarzt:   { label: 'Assistenzarzt',        color: '#22C55E', tier: 2 },
  rettungssani:    { label: 'Rettungssanitäter',    color: '#14B8A6', tier: 2 },
  notfallsani:     { label: 'Notfallsanitäter',     color: '#0EA5E9', tier: 2 },
  praktikant:      { label: 'Praktikant',           color: '#8899AA', tier: 1 },
};

// ---- Status ----
const STATUS = {
  AKTIV:        { label: 'Aktiv',        color: '#22C55E' },
  PAUSE:        { label: 'Pause/Aussatz', color: '#F59E0B' },
  BEURLAUBT:    { label: 'Beurlaubt',    color: '#0EA5E9' },
  SUSPENDIERT:  { label: 'Suspendiert',  color: '#FF4F6C' },
  AUSBILDUNG:   { label: 'In Ausbildung', color: '#A78BFA' },
  ENTLASSEN:    { label: 'Entlassen',    color: '#8899AA' },
  BLACKLIST:    { label: 'Blacklist',    color: '#CC2233' },
  SONSTIGES:    { label: 'Sonstiges',    color: '#64748B' },
};

const DEPARTMENTS = ['Notaufnahme', 'Rettungsdienst', 'Chirurgie', 'Verwaltung', 'Ausbildung'];

// avatar helper – deterministic pastel monogram
function avatarFor(name) {
  return name.split(' ').map(p => p[0]).slice(0, 2).join('').toUpperCase();
}

// ---- Mitarbeiter ----
const MEMBERS = [
  { id: 1,  name: 'Dr. Marcus Vance',   dn: 'LSMD-001', rank: 'aerztl_direktor', dept: 'Verwaltung',      status: 'AKTIV',      since: '14.01.2024', discord: 'm.vance#0001',  hours: 412, ausb: 9, fach: 4 },
  { id: 2,  name: 'Dr. Elena Cross',    dn: 'LSMD-002', rank: 'stellv_direktor', dept: 'Chirurgie',       status: 'AKTIV',      since: '21.01.2024', discord: 'elena.c#7720',  hours: 388, ausb: 8, fach: 4 },
  { id: 3,  name: 'Dr. Tobias Reyes',   dn: 'LSMD-007', rank: 'chefarzt',        dept: 'Notaufnahme',     status: 'AKTIV',      since: '03.02.2024', discord: 'treyes#1144',   hours: 351, ausb: 7, fach: 3 },
  { id: 4,  name: 'Dr. Hannah Berg',    dn: 'LSMD-011', rank: 'oberarzt',        dept: 'Notaufnahme',     status: 'AKTIV',      since: '19.02.2024', discord: 'h.berg#5560',   hours: 309, ausb: 6, fach: 3 },
  { id: 5,  name: 'Dr. Samuel Okonkwo', dn: 'LSMD-014', rank: 'oberarzt',        dept: 'Chirurgie',       status: 'PAUSE',      since: '02.03.2024', discord: 'sam.ok#0099',   hours: 274, ausb: 6, fach: 2 },
  { id: 6,  name: 'Dr. Lena Fischer',   dn: 'LSMD-018', rank: 'facharzt',        dept: 'Rettungsdienst',  status: 'AKTIV',      since: '11.03.2024', discord: 'lfischer#3321', hours: 256, ausb: 5, fach: 2 },
  { id: 7,  name: 'Jonas Weiß',         dn: 'LSMD-022', rank: 'rettungssani',    dept: 'Rettungsdienst',  status: 'AKTIV',      since: '27.03.2024', discord: 'jweiss#8812',   hours: 231, ausb: 4, fach: 1 },
  { id: 8,  name: 'Mira Aydın',         dn: 'LSMD-025', rank: 'notfallsani',     dept: 'Rettungsdienst',  status: 'AKTIV',      since: '04.04.2024', discord: 'mira.a#4410',   hours: 219, ausb: 4, fach: 1 },
  { id: 9,  name: 'Dr. Paul Henning',   dn: 'LSMD-029', rank: 'facharzt',        dept: 'Chirurgie',       status: 'BEURLAUBT',  since: '18.04.2024', discord: 'phenning#2200', hours: 198, ausb: 5, fach: 2 },
  { id: 10, name: 'Carla Mendes',       dn: 'LSMD-033', rank: 'assistenzarzt',   dept: 'Notaufnahme',     status: 'AKTIV',      since: '02.05.2024', discord: 'carlam#6677',   hours: 187, ausb: 3, fach: 1 },
  { id: 11, name: 'Tim Brandt',         dn: 'LSMD-037', rank: 'notfallsani',     dept: 'Rettungsdienst',  status: 'AUSBILDUNG', since: '20.05.2024', discord: 'tbrandt#1133',  hours: 96,  ausb: 2, fach: 0 },
  { id: 12, name: 'Sophie Lang',        dn: 'LSMD-041', rank: 'praktikant',      dept: 'Ausbildung',      status: 'AUSBILDUNG', since: '08.06.2024', discord: 'sophie.l#9090', hours: 54,  ausb: 1, fach: 0 },
  { id: 13, name: 'Dr. Igor Petrow',    dn: 'LSMD-016', rank: 'facharzt',        dept: 'Chirurgie',       status: 'SUSPENDIERT',since: '06.03.2024', discord: 'ipetrow#7474',  hours: 240, ausb: 5, fach: 2 },
  { id: 14, name: 'Nadia Khan',         dn: 'LSMD-044', rank: 'assistenzarzt',   dept: 'Notaufnahme',     status: 'AKTIV',      since: '15.06.2024', discord: 'nkhan#5511',    hours: 142, ausb: 3, fach: 1 },
  { id: 15, name: 'Ben Hofer',          dn: 'LSMD-009', rank: 'rettungssani',    dept: 'Rettungsdienst',  status: 'ENTLASSEN',  since: '24.02.2024', discord: 'bhofer#0303',   hours: 168, ausb: 3, fach: 1 },
];

const LEADERSHIP = MEMBERS.filter(m => RANKS[m.rank].tier >= 4 && m.status === 'AKTIV');

// ---- Versicherungen ----
const INSURANCES = [
  { id: 'V-2041', name: 'Familie Delgado',     type: 'Mehrfach',  insured: 4, from: '12.05.2026', to: '12.06.2026', state: 'aktiv' },
  { id: 'V-2038', name: 'Anton Reeves',        type: 'Einzel',    insured: 1, from: '08.05.2026', to: '08.06.2026', state: 'aktiv' },
  { id: 'V-2033', name: 'Yusuf Demir',         type: 'Einzel',    insured: 1, from: '01.05.2026', to: '04.06.2026', state: 'faellig' },
  { id: 'V-2029', name: 'Familie Cohen',       type: 'Mehrfach',  insured: 3, from: '28.04.2026', to: '05.06.2026', state: 'faellig' },
  { id: 'V-2018', name: 'Grace Albright',      type: 'Einzel',    insured: 1, from: '02.04.2026', to: '28.05.2026', state: 'abgelaufen' },
  { id: 'V-2011', name: 'Kollektiv Vespucci',  type: 'Mehrfach',  insured: 5, from: '25.03.2026', to: '24.05.2026', state: 'abgelaufen' },
  { id: 'V-2044', name: 'Iris Novak',          type: 'Einzel',    insured: 1, from: '20.05.2026', to: '20.06.2026', state: 'aktiv' },
  { id: 'V-2046', name: 'Familie Okoro',       type: 'Mehrfach',  insured: 6, from: '24.05.2026', to: '24.06.2026', state: 'aktiv' },
];

// ---- Dashboard KPIs ----
const KPIS = [
  { label: 'Mit Zielposition',   value: '32', sub: 'von 41 Mitarbeitern', icon: 'Target',       tone: 'accent' },
  { label: 'Zielposition erfüllt', value: '18', sub: '56 % der Anwärter', icon: 'CircleCheck',  tone: 'success' },
  { label: 'Ziel-Ränge',         value: '7',  sub: 'definierte Stufen',  icon: 'Layers',       tone: 'ink' },
  { label: 'Arztstatus',         value: '24',  sub: 'approbierte Ärzte',  icon: 'Stethoscope',  tone: 'ink' },
  { label: 'Ø Zugehörigkeit',    value: '6,4', sub: 'Monate',            icon: 'CalendarDays', tone: 'ink' },
  { label: 'Ø Ausbildungen',     value: '4,3', sub: 'pro Mitarbeiter',   icon: 'GraduationCap',tone: 'ink' },
  { label: 'Ø Fachärzte',        value: '1,8', sub: 'Spezialisierungen', icon: 'BadgeCheck',   tone: 'ink' },
  { label: 'Account Coverage',   value: '93 %',sub: 'Discord verknüpft', icon: 'ShieldCheck',  tone: 'success' },
  { label: 'Phone Coverage',     value: '88 %',sub: 'Nummer hinterlegt', icon: 'Phone',        tone: 'warning' },
  { label: 'Profilqualität',     value: '81 %',sub: 'vollständige Profile', icon: 'Gauge',     tone: 'accent' },
];

// ---- Charts ----
const STATUS_DONUT = [
  { name: 'Aktiv',        value: 41, fill: '#22C55E' },
  { name: 'Pause',        value: 6,  fill: '#F59E0B' },
  { name: 'Beurlaubt',    value: 3,  fill: '#0EA5E9' },
  { name: 'In Ausbildung',value: 5,  fill: '#A78BFA' },
];
const WARN_BARS = [
  { name: 'Stufe 0', value: 34, fill: '#22C55E' },
  { name: 'Stufe 1', value: 9,  fill: '#F59E0B' },
  { name: 'Stufe 2', value: 4,  fill: '#FF4F6C' },
  { name: 'Stufe 3', value: 1,  fill: '#CC2233' },
];
const TOP_POSITIONS = [
  { name: 'Rettungssani.',  value: 12 },
  { name: 'Notfallsani.',   value: 10 },
  { name: 'Assistenzarzt',  value: 8 },
  { name: 'Facharzt',       value: 6 },
  { name: 'Oberarzt',       value: 3 },
  { name: 'Chefarzt',       value: 2 },
];
const TIMELINE_TYPES = [
  { name: 'Beförderung',  value: 38, fill: '#CC2233' },
  { name: 'Ausbildung',   value: 52, fill: '#F59E0B' },
  { name: 'Verwarnung',   value: 14, fill: '#FF4F6C' },
  { name: 'Lob',          value: 21, fill: '#22C55E' },
  { name: 'Sonstiges',    value: 9,  fill: '#8899AA' },
];
const TARGET_POSITIONS = [
  { rank: 'Facharzt',      anwaerter: 9,  erfuellt: 5 },
  { rank: 'Oberarzt',      anwaerter: 6,  erfuellt: 3 },
  { rank: 'Chefarzt',      anwaerter: 4,  erfuellt: 1 },
  { rank: 'Rettungssani.', anwaerter: 8,  erfuellt: 6 },
  { rank: 'Notfallsani.',  anwaerter: 5,  erfuellt: 3 },
];
const WEEK_PERF = [
  { week: 'KW 18', std: 142, bef: 2 },
  { week: 'KW 19', std: 168, bef: 1 },
  { week: 'KW 20', std: 151, bef: 3 },
  { week: 'KW 21', std: 189, bef: 0 },
  { week: 'KW 22', std: 174, bef: 2 },
  { week: 'KW 23', std: 203, bef: 4 },
];

// ---- Theme-Templates fürs Studio ----
const THEME_TEMPLATES = [
  { id: 'dark-red',     name: 'Dark Red',      tag: 'Standard LSMD', vars: { '--c-bg':'#0A1628','--c-bg2':'#0c1a2f','--c-card':'#1C2A3A','--c-border':'#2A3A4A','--c-accent':'#CC2233','--c-accent-soft':'rgba(204,34,51,0.16)','--c-signal':'#FF4F6C' }, swatch: ['#0A1628','#CC2233','#FF4F6C'] },
  { id: 'dark-blue',    name: 'Dark Blue',     tag: 'Maritim',       vars: { '--c-bg':'#091221','--c-bg2':'#0b1830','--c-card':'#152238','--c-border':'#243650','--c-accent':'#2A6FDB','--c-accent-soft':'rgba(42,111,219,0.18)','--c-signal':'#4F9CFF' }, swatch: ['#091221','#2A6FDB','#4F9CFF'] },
  { id: 'night-crystal',name: 'Night Crystal', tag: 'Schwarz / Weiß',vars: { '--c-bg':'#0B0B0D','--c-bg2':'#111114','--c-card':'#17171B','--c-border':'#2A2A30','--c-accent':'#E5E7EB','--c-accent-soft':'rgba(229,231,235,0.12)','--c-signal':'#FFFFFF' }, swatch: ['#0B0B0D','#E5E7EB','#FFFFFF'] },
  { id: 'onyx-saffron', name: 'Onyx Saffron',  tag: 'Dunkel / Safran',vars: { '--c-bg':'#100E0A','--c-bg2':'#16130c','--c-card':'#1E1A12','--c-border':'#332C1E','--c-accent':'#E0A33A','--c-accent-soft':'rgba(224,163,58,0.16)','--c-signal':'#F5C566' }, swatch: ['#100E0A','#E0A33A','#F5C566'] },
  { id: 'signal-halo',  name: 'Signal Halo',   tag: 'Magenta / Halo',vars: { '--c-bg':'#0E0913','--c-bg2':'#150c1c','--c-card':'#1C1226','--c-border':'#33203F','--c-accent':'#D6328C','--c-accent-soft':'rgba(214,50,140,0.18)','--c-signal':'#FF5FB0' }, swatch: ['#0E0913','#D6328C','#FF5FB0'] },
  { id: 'neon-dream',   name: 'Neon Dream',    tag: 'Magenta / Cyan',vars: { '--c-bg':'#0A0A14','--c-bg2':'#0e0e1d','--c-card':'#15162a','--c-border':'#262a4a','--c-accent':'#C026D3','--c-accent-soft':'rgba(192,38,211,0.18)','--c-signal':'#22D3EE' }, swatch: ['#0A0A14','#C026D3','#22D3EE'] },
];

Object.assign(window, {
  RANKS, STATUS, DEPARTMENTS, MEMBERS, LEADERSHIP, INSURANCES, KPIS,
  STATUS_DONUT, WARN_BARS, TOP_POSITIONS, TIMELINE_TYPES, TARGET_POSITIONS, WEEK_PERF,
  THEME_TEMPLATES, avatarFor,
});
