// WXG MOVEO — simplified dashboard data, mirrors the live Power-BI report.
// Five pages, same global filters across all of them.

const D2 = {
  // Header / global filter row (same across all pages)
  filters: [
    { k: 'פרויקט',          v: 'הכל' },
    { k: 'טווח תאריכים',   v: '01/06/2025 — 31/12/2025' },
    { k: 'לקוח',             v: 'הכל' },
    { k: 'אבן-דרך',          v: 'הכל' },
  ],

  // ── PAGE 1 · סקירה כללית ────────────────────────────
  p1: {
    counters: {
      surveys: 90,
      contacts: 75,
      promotersPct: 65.56,
      detractorsPct: 10,
      nps: 55.56,
    },
    distribution: [
      { k: 'Promoters', v: 65.6, c: 'green' },
      { k: 'Passives',  v: 24.4, c: 'gold' },
      { k: 'Detractors', v: 10,  c: 'wine' },
    ],
    statusDonut: [
      { k: 'Completed', v: 68.2, c: 'green' },
      { k: 'Expired',   v: 25,   c: 'gold' },
      { k: 'Created',   v: 6.8,  c: 'grey' },
    ],
    milestoneDonut: [
      { k: 'ירידה לביצוע', v: 50,   c: 'green' },
      { k: 'אחת לשנה',      v: 33.3, c: 'gold' },
      { k: 'טופס 4',         v: 16.7, c: 'wine' },
    ],
    // NPS trend lines — 3 series across months
    trend: {
      months: ['Jun 2025', 'Jul 2025', 'Aug 2025', 'Sep 2025', 'Oct 2025', 'Nov 2025', 'Dec 2025'],
      series: [
        { k: 'ירידה לביצוע', c: 'amber',
          v: [42, 48, 53, 51, 57, 60, 62] },
        { k: 'אחת לשנה',      c: 'green',
          v: [30, 35, 42, 50, 55, 58, 56] },
        { k: 'טופס 4',         c: 'wine',
          v: [-20, -10, 5, 12, 18, 22, 28] },
      ],
    },
  },

  // ── PAGE 2 · סטטוס ושיטות איסוף ─────────────────────
  p2: {
    completedSurveys: 90,
    // Stacked / grouped bar — by collection method × status
    methodStatus: {
      methods: ['Digital', 'Manual'],
      statuses: ['Completed', 'Expired', 'Created', 'Duplicate'],
      data: [
        // [digital, manual] per status
        { status: 'Completed', digital: 44, manual: 46 },
        { status: 'Expired',   digital: 33, manual: 72 },
        { status: 'Created',   digital: 22, manual: 38 },
        { status: 'Duplicate', digital: 8,  manual: 14 },
      ],
    },
    // Completed surveys by platform
    platform: [
      { k: 'Digital', v: 54, c: 'amber' },
      { k: 'Manual',  v: 36, c: 'grey' },
    ],
    // Digital surveys by status — donut
    digitalStatus: [
      { k: 'Completed', v: 51.2, c: 'green' },
      { k: 'Expired',   v: 38.4, c: 'gold' },
      { k: 'Other',     v: 8.1,  c: 'grey' },
    ],
    // Digital completed with meaningful text — true/false
    meaningfulText: [
      { k: 'true',  v: 56.8, c: 'green' },
      { k: 'false', v: 43.2, c: 'wine' },
    ],
  },

  // ── PAGE 3 · ניתוח תגובות (table + matrix) ─────────────
  p3: {
    // Response detail table
    rows: [
      { i: 1,  name: 'אבי זמיר',         milestone: 'ירידה לביצוע', note: '',                                                       nps: null },
      { i: 2,  name: 'אבי זמיר',         milestone: 'טופס 4',         note: '',                                                       nps: null },
      { i: 3,  name: 'אבי רוזן',         milestone: 'ירידה לביצוע', note: 'הצוות מקצועי ושירותי, שרית פנחס מצוינת',                  nps: 100  },
      { i: 4,  name: 'אבי שגב',          milestone: 'אחת לשנה',      note: 'יש לבצע עבודות נוספות בחשמל וביצוע',                       nps: 0    },
      { i: 5,  name: 'אביעד ביטון',      milestone: 'אחת לשנה',      note: '',                                                       nps: null },
      { i: 6,  name: 'אדוארד קירזנר',    milestone: 'אחת לשנה',      note: 'אין מה להוסיף',                                          nps: 100  },
      { i: 7,  name: 'אוהד חן',           milestone: 'אחת לשנה',      note: 'מרוצה מאוד מהשירות',                                    nps: 100  },
      { i: 8,  name: 'אופיר רוזנפלד',    milestone: 'אחת לשנה',      note: 'תמיד מתקיים וזה עוזר משמעותית',                         nps: 100  },
      { i: 9,  name: 'אור טאובין',        milestone: 'ירידה לביצוע', note: '.',                                                      nps: 100  },
      { i: 10, name: 'אור מאמו',          milestone: 'אחת לשנה',      note: 'יעקובי אחלה, אך הוא לא מספיק',                            nps: -100 },
      { i: 11, name: 'אורי שלו',          milestone: 'טופס 4',         note: 'הצוות עונה בזמן, חבל שיש עיכובים',                       nps: 50   },
      { i: 12, name: 'איתי בר-און',       milestone: 'ירידה לביצוע', note: '',                                                       nps: null },
    ],
    pagination: { from: 1, to: 100, total: 125 },

    // Matrix: project × milestone → NPS
    matrix: {
      milestones: ['ירידה לביצוע', 'אחת לשנה', 'טופס 4'],
      projects: [
        { name: 'אסותא ב״ש',                vals: [null, null, null] },
        { name: 'אגד — המלמד',               vals: [null, null, null] },
        { name: 'מגדל אדגר',                   vals: [null, null, null] },
        { name: 'קטע מזרחית הסעות',           vals: [null, -100, null] },
        { name: 'עד 120 נס ציונה',             vals: [null, -100, null] },
        { name: 'היי טאוור',                    vals: [null, null, -50] },
        { name: 'שפע בני ברק',                 vals: [50, -33.33, null] },
        { name: 'מגדלי יבנה צפון',             vals: [78, 64, 42] },
        { name: 'פארק רעננה — מתחם A',         vals: [74, 60, null] },
        { name: 'נווה צדק 22',                  vals: [71, 55, null] },
        { name: 'גני תקווה — שלב ב׳',           vals: [null, 53, 12] },
        { name: 'מתחם הברזל תל אביב',          vals: [48, 38, null] },
      ],
      total: { vals: [56.25, 55.56, 40] },
    },
  },

  // ── PAGE 4 · אנליטיקס משובים ────────────────────────
  p4: {
    surveysCreated: 132,
    surveysViewed: 0,
    surveysSent: 0,
    // Funnel
    funnel: [
      { k: 'נוצרו',     v: 132, c: 'amber' },
      { k: 'נשלחו',     v: 115, c: 'amber' },
      { k: 'נצפו',      v: 97,  c: 'amber' },
      { k: 'נפתחו',     v: 88,  c: 'amber' },
      { k: 'הושלמו',    v: 90,  c: 'green' },
    ],
    // Contact progression rows
    progress: [
      { name: 'תומר רוזנברג', furthest: 'null', stage: 1, status: 'Created', created: 'Dec 8, 2025, 5:49:00 PM',  ms: 195347 },
      { name: 'תומר אלפסי',    furthest: 'null', stage: 1, status: 'Created', created: 'Jun 18, 2025, 8:55:00 PM', ms: 444281 },
      { name: 'שרון ואקנין',    furthest: 'null', stage: 1, status: 'Created', created: 'Jun 18, 2025, 9:36:00 PM', ms: 444240 },
      { name: 'שרון אריה',      furthest: 'null', stage: 1, status: 'Created', created: 'Jun 18, 2025, 9:37:00 PM', ms: 444239 },
      { name: 'שרון אריה',      furthest: 'null', stage: 1, status: 'Created', created: 'Jun 18, 2025, 9:49:00 PM', ms: 444227 },
      { name: 'שרון אריה',      furthest: 'null', stage: 1, status: 'Created', created: 'Jun 18, 2025, 9:48:00 PM', ms: 444228 },
      { name: 'שלו לביא',       furthest: 'null', stage: 1, status: 'Created', created: 'Jun 18, 2025, 8:47:00 PM', ms: 444289 },
      { name: 'רפאל זכרוב',     furthest: 'null', stage: 1, status: 'Created', created: 'Jun 29, 2025, 4:15:00 PM', ms: 428721 },
      { name: 'רן מלכה',        furthest: 'null', stage: 1, status: 'Created', created: 'Jun 18, 2025, 1:58:00 PM', ms: 444698 },
      { name: 'רן כרמי',         furthest: 'null', stage: 1, status: 'Created', created: 'Jun 18, 2025, 9:37:00 PM', ms: 444239 },
      { name: 'רותם רביבי',     furthest: 'null', stage: 1, status: 'Created', created: 'Jun 18, 2025, 3:57:00 PM', ms: 444579 },
      { name: 'רועי וולף',       furthest: 'null', stage: 1, status: 'Created', created: 'Jun 18, 2025, 9:32:00 PM', ms: 444244 },
    ],
    progressTotal: 37225958,
    progressPagination: { from: 1, to: 87, total: 87 },
  },

  // ── PAGE 5 · ניתוח לפי שאלה ─────────────────────────
  p5: {
    counters: { customers: 31, projects: 39, surveys: 90, contacts: 75 },
    questions: [
      {
        text: 'מהי מידת שביעות רצונך מניהול תהליך המכרזים?',
        nps: 63.64, npsLabel: 'NPS_Tenders',
        // bars: scores 6,7,8,9,10 — values mapped
        bars: [ { x: 6, v: 1 }, { x: 7, v: 6 }, { x: 8, v: 8 }, { x: 9, v: 9 }, { x: 10, v: 10 } ],
      },
      {
        text: 'באיזו מידה היית מרוצה מצוות הפרויקט?',
        nps: 45.28, npsLabel: 'NPS_Team',
        bars: [ { x: 6, v: 2 }, { x: 7, v: 5 }, { x: 8, v: 15 }, { x: 9, v: 16 }, { x: 10, v: 15 } ],
      },
      {
        text: 'מהי מידת שביעות רצונך מניהול תהליך הרישוי?',
        nps: 53.85, npsLabel: 'NPS_Licensing',
        bars: [ { x: 6, v: 0 }, { x: 7, v: 6 }, { x: 8, v: 12 }, { x: 9, v: 8 }, { x: 10, v: 0 } ],
      },
      {
        text: 'באיזו מידה היית ממליצ/ה להיות לקוח/ה של וקסמן גרופ על בסיס השירותים שקיבלת עד כה בפרויקט?',
        nps: 51.22, npsLabel: 'NPS Score',
        bars: [ { x: 6, v: 3 }, { x: 7, v: 6 }, { x: 8, v: 20 }, { x: 9, v: 22 }, { x: 10, v: 31 } ],
      },
      {
        text: 'מהי מידת שביעות רצונך מניהול תהליך התכנון?',
        nps: 61.54, npsLabel: 'NPS_Planning',
        bars: [ { x: 6, v: 0 }, { x: 7, v: 0 }, { x: 8, v: 7 }, { x: 9, v: 9 }, { x: 10, v: 10 } ],
      },
    ],
  },

  // Tab definitions
  tabs: [
    { id: 'p1', label: 'סקירה כללית' },
    { id: 'p2', label: 'שיטות איסוף' },
    { id: 'p3', label: 'ניתוח תגובות' },
    { id: 'p4', label: 'אנליטיקס משובים' },
    { id: 'p5', label: 'ניתוח לפי שאלה' },
  ],
};

window.D2 = D2;
