// ─────────────────────────────────────────────────────────
// ChefVerse · Nested curriculum model (V4 — FINAL 5-module map)
//
// Structure locked to the "UFS ChefVerse Introductory Copy FINAL":
//   1. Introduction
//   2. Chef to Personal Brand
//   3. From set-up to success   (hub → 3.1 Pick your platform, 3.2 Filming & Editing)
//   4. Using Products Naturally
//   5. Working with brands
//
// SHAPE (CMS / Strapi-ready):
//   module { id, num, title{locale}, intro{locale}, outcomes{locale:[]},
//            directLessons[], subModules[]{ id, num, title, intro, outcomes, lessons[] } }
//   lesson { id, title{locale}, type:"video"|"written"|"graphic"|"carousel",
//            dur, cards, completion }
// ─────────────────────────────────────────────────────────

const LESSON_COMPLETION = {
  video: "watch",
  written: "scroll",
  graphic: "load",
  carousel: "carousel-all",
};

function _lesson(id, type, title, opts) {
  opts = opts || {};
  return {
    id,
    type,
    title,
    dur: opts.dur || 0,
    cards: opts.cards || (type === "carousel" ? 5 : 0),
    completion: LESSON_COMPLETION[type],
  };
}

// ── The FINAL 5-module chef journey ──
const CURRICULUM = [
  {
    id: "m1",
    num: "1",
    thumb: "https://images.unsplash.com/photo-1556910103-1c02745aae4d?auto=format&fit=crop&w=1200&h=700&q=70&crop=entropy",
    title: { en: "Introduction", de: "Einführung", id: "Pengantar" },
    intro: {
      en: "Great food deserves to be seen. In this module, you'll discover how ChefVerse can help you share your skills, passion, and perspective with the world. We'll introduce the platform, show you how to get the most from it, and help you take the first step towards building an online presence that grows with your career.",
      de: "Gutes Essen verdient es, gesehen zu werden. In diesem Modul entdeckst du, wie ChefVerse dir hilft, dein Können, deine Leidenschaft und deine Sichtweise mit der Welt zu teilen. Wir stellen die Plattform vor, zeigen dir, wie du das Beste aus ihr herausholst, und helfen dir beim ersten Schritt zu einer Online-Präsenz, die mit deiner Karriere wächst.",
      id: "Makanan hebat layak untuk dilihat. Dalam modul ini, kamu akan menemukan bagaimana ChefVerse membantumu berbagi keterampilan, passion, dan sudut pandangmu dengan dunia. Kami akan memperkenalkan platform, menunjukkan cara memaksimalkannya, dan membantumu mengambil langkah pertama membangun kehadiran online yang tumbuh bersama kariermu.",
    },
    outcomes: {
      en: [
        "Discover how chefs are using social media to showcase their expertise, connect with new audiences, and unlock new opportunities.",
        "Learn how ChefVerse works, from rewards and content briefs to the tools and support available along the way.",
        "Explore your interests, strengths, and goals to start defining the content style that's right for you.",
      ],
      de: [
        "Entdecke, wie Köche soziale Medien nutzen, um ihr Können zu zeigen, neue Zielgruppen zu erreichen und neue Chancen zu erschließen.",
        "Lerne, wie ChefVerse funktioniert – von Prämien und Content-Briefings bis zu den Tools und der Unterstützung auf dem Weg.",
        "Erkunde deine Interessen, Stärken und Ziele, um den Content-Stil zu definieren, der zu dir passt.",
      ],
      id: [
        "Temukan bagaimana chef menggunakan media sosial untuk menampilkan keahlian, terhubung dengan audiens baru, dan membuka peluang baru.",
        "Pelajari cara kerja ChefVerse, dari reward dan brief konten hingga tools dan dukungan yang tersedia.",
        "Jelajahi minat, kekuatan, dan tujuanmu untuk mulai menentukan gaya konten yang tepat untukmu.",
      ],
    },
    directLessons: [
      _lesson("m1-l1", "video", { en: "Introduction", de: "Einführung", id: "Pengantar" }, { dur: 300 }),
    ],
    subModules: [],
  },
  {
    id: "m2",
    num: "2",
    thumb: "https://images.unsplash.com/photo-1577219491135-ce391730fb2c?auto=format&fit=crop&w=1200&h=700&q=70&crop=entropy",
    title: { en: "Chef to Personal Brand", de: "Vom Koch zur eigenen Marke", id: "Dari Chef ke Brand Pribadi" },
    intro: {
      en: "The most successful chef creators aren't copying trends, they're sharing what genuinely excites them. In this module, you'll learn how to develop a content style that's authentic, professional, and uniquely yours, while understanding exactly what great chef-led content looks like.",
      de: "Die erfolgreichsten Chef-Creator kopieren keine Trends – sie teilen, was sie wirklich begeistert. In diesem Modul lernst du, einen Content-Stil zu entwickeln, der authentisch, professionell und unverkennbar deiner ist, und verstehst genau, wie großartiger chef-geführter Content aussieht.",
      id: "Chef creator paling sukses tidak meniru tren, mereka berbagi apa yang benar-benar menggairahkan mereka. Dalam modul ini, kamu akan belajar mengembangkan gaya konten yang autentik, profesional, dan khas milikmu, sambil memahami persis seperti apa konten chef yang hebat.",
    },
    outcomes: {
      en: [
        "Find your niche and create content that feels natural to make and valuable to watch.",
        "Understand the ingredients of great chef-led content through real examples and best practices.",
        "Learn how to grow an engaged audience.",
      ],
      de: [
        "Finde deine Nische und erstelle Content, der sich natürlich anfühlt und sehenswert ist.",
        "Verstehe die Zutaten großartigen chef-geführten Contents anhand echter Beispiele und Best Practices.",
        "Lerne, wie du ein engagiertes Publikum aufbaust.",
      ],
      id: [
        "Temukan nichemu dan buat konten yang terasa natural dibuat dan berharga ditonton.",
        "Pahami bahan-bahan konten chef yang hebat melalui contoh nyata dan praktik terbaik.",
        "Pelajari cara menumbuhkan audiens yang terlibat.",
      ],
    },
    directLessons: [
      _lesson("m2-l1", "video", { en: "Chef to Personal Brand", de: "Vom Koch zur eigenen Marke", id: "Dari Chef ke Brand Pribadi" }, { dur: 300 }),
    ],
    subModules: [],
  },
  {
    id: "m3",
    num: "3",
    thumb: "https://images.unsplash.com/photo-1559847844-5315695dadae?auto=format&fit=crop&w=1200&h=700&q=70&crop=entropy",
    title: { en: "From set-up to success", de: "Von Setup zu Erfolg", id: "Dari setup ke sukses" },
    intro: {
      en: "Great content doesn't happen by accident. In this module, you'll learn the practical skills behind creating engaging social content, from choosing the right platform and filming setup to editing, storytelling, and understanding what keeps audiences watching. Whether you're filming on your phone or refining your process, you'll gain the tools to create content with confidence.",
      de: "Guter Content entsteht nicht zufällig. In diesem Modul lernst du die praktischen Fähigkeiten hinter fesselndem Social-Content – von der Wahl der richtigen Plattform und dem Film-Setup bis zu Schnitt, Storytelling und dem Verständnis, was Zuschauer bei der Stange hält. Ob du mit dem Handy filmst oder deinen Prozess verfeinerst, du erhältst die Werkzeuge, um mit Selbstvertrauen Content zu erstellen.",
      id: "Konten hebat tidak terjadi secara kebetulan. Dalam modul ini, kamu akan mempelajari keterampilan praktis di balik pembuatan konten sosial yang menarik, dari memilih platform yang tepat dan setup syuting hingga editing, storytelling, dan memahami apa yang membuat audiens terus menonton. Baik kamu syuting dengan ponsel atau menyempurnakan prosesmu, kamu akan mendapatkan tools untuk membuat konten dengan percaya diri.",
    },
    outcomes: {
      en: [
        "Learn what to create, where to post, and how each platform rewards content.",
        "Build confidence on camera with practical filming, lighting, audio, editing, and presentation tips.",
        "Create engaging content that showcases products and partnerships authentically.",
      ],
      de: [
        "Lerne, was du erstellst, wo du postest und wie jede Plattform Content belohnt.",
        "Gewinne Selbstvertrauen vor der Kamera mit praktischen Tipps zu Filmen, Licht, Ton, Schnitt und Präsentation.",
        "Erstelle fesselnden Content, der Produkte und Partnerschaften authentisch zeigt.",
      ],
      id: [
        "Pelajari apa yang dibuat, di mana memposting, dan bagaimana setiap platform menghargai konten.",
        "Bangun rasa percaya diri di depan kamera dengan tips praktis syuting, pencahayaan, audio, editing, dan presentasi.",
        "Buat konten menarik yang menampilkan produk dan kemitraan secara autentik.",
      ],
    },
    directLessons: [],
    subModules: [
      {
        id: "m3-1",
        num: "3.1",
        thumb: "https://images.unsplash.com/photo-1565299624946-b28f40a0ae38?auto=format&fit=crop&w=1200&h=700&q=70&crop=entropy",
        title: { en: "Pick your platform", de: "Wähle deine Plattform", id: "Pilih platform kamu" },
        intro: {
          en: "Before you start creating content, it's important to understand the basics. In this module, you'll learn how different social platforms work, when to use short-form versus long-form content, how to write captions that drive engagement, and which metrics actually matter. These foundations will help you create content with purpose, not guesswork.",
          de: "Bevor du mit dem Erstellen beginnst, ist es wichtig, die Grundlagen zu verstehen. In diesem Modul lernst du, wie verschiedene Social-Plattformen funktionieren, wann du Kurz- versus Langform nutzt, wie du Captions schreibst, die Engagement fördern, und welche Kennzahlen wirklich zählen. Diese Grundlagen helfen dir, Content mit Absicht zu erstellen – nicht auf gut Glück.",
          id: "Sebelum mulai membuat konten, penting untuk memahami dasarnya. Dalam modul ini, kamu akan belajar cara kerja berbagai platform sosial, kapan menggunakan konten pendek versus panjang, cara menulis caption yang mendorong engagement, dan metrik mana yang benar-benar penting. Fondasi ini membantumu membuat konten dengan tujuan, bukan menebak-nebak.",
        },
        outcomes: {
          en: [
            "Choose the right platform for your goals.",
            "Learn when to create short-form vs. long-form content.",
            "Write stronger captions that drive engagement.",
            "Track the metrics that matter and improve performance over time.",
          ],
          de: [
            "Wähle die richtige Plattform für deine Ziele.",
            "Lerne, wann du Kurzform- vs. Langform-Content erstellst.",
            "Schreibe stärkere Captions, die Engagement fördern.",
            "Verfolge die Kennzahlen, die zählen, und verbessere deine Performance mit der Zeit.",
          ],
          id: [
            "Pilih platform yang tepat untuk tujuanmu.",
            "Pelajari kapan membuat konten pendek vs. panjang.",
            "Tulis caption yang lebih kuat yang mendorong engagement.",
            "Lacak metrik yang penting dan tingkatkan performa seiring waktu.",
          ],
        },
        lessons: [
          _lesson("m3-1-l1", "graphic", { en: "Pick your platform", de: "Wähle deine Plattform", id: "Pilih platform kamu" }),
          _lesson("m3-1-l2", "video", { en: "Pick your platform", de: "Wähle deine Plattform", id: "Pilih platform kamu" }, { dur: 90 }),
          _lesson("m3-1-l3", "video", { en: "Serving snacks vs courses", de: "Snacks vs. Menüs servieren", id: "Sajikan camilan vs hidangan" }, { dur: 60 }),
          _lesson("m3-1-l4", "written", { en: "Plating your words", de: "Deine Worte anrichten", id: "Menata kata-katamu" }),
          _lesson("m3-1-l5", "video", { en: "Measuring success", de: "Erfolg messen", id: "Mengukur sukses" }, { dur: 60 }),
          _lesson("m3-1-l6", "graphic", { en: "Measuring success", de: "Erfolg messen", id: "Mengukur sukses" }),
        ],
      },
      {
        id: "m3-2",
        num: "3.2",
        thumb: "https://images.unsplash.com/photo-1432139509613-5c4255815697?auto=format&fit=crop&w=1200&h=700&q=70&crop=entropy",
        title: { en: "Simple Filming & Editing for Real Kitchens", de: "Einfaches Filmen & Schneiden für echte Küchen", id: "Syuting & Editing Sederhana untuk Dapur Nyata" },
        intro: {
          en: "Creating great content doesn't require a studio setup or expensive equipment. In this module, you'll learn how to capture high-quality content using simple tools, set up your kitchen for filming, and edit your videos into polished, engaging posts. From lighting and audio to hooks and editing, we'll cover the essentials that make content easy to watch and easy to create.",
          de: "Großartigen Content zu erstellen erfordert kein Studio-Setup oder teure Ausrüstung. In diesem Modul lernst du, hochwertigen Content mit einfachen Werkzeugen aufzunehmen, deine Küche fürs Filmen einzurichten und deine Videos zu ausgefeilten, fesselnden Posts zu schneiden. Von Licht und Ton bis zu Hooks und Schnitt decken wir die Essentials ab, die Content leicht anzusehen und leicht zu erstellen machen.",
          id: "Membuat konten hebat tidak memerlukan setup studio atau peralatan mahal. Dalam modul ini, kamu akan belajar menangkap konten berkualitas tinggi dengan tools sederhana, menyiapkan dapurmu untuk syuting, dan mengedit videomu menjadi post yang rapi dan menarik. Dari pencahayaan dan audio hingga hook dan editing, kami akan membahas hal-hal penting yang membuat konten mudah ditonton dan mudah dibuat.",
        },
        outcomes: {
          en: [
            "Film with confidence using simple tools, smart setup techniques, and a kitchen that's ready for camera.",
            "Make your content look and sound better with practical tips on lighting, audio, framing, and presentation.",
            "Turn your footage into engaging content with strong hooks, simple editing techniques, captions, music, and finishing touches.",
          ],
          de: [
            "Filme mit Selbstvertrauen mit einfachen Werkzeugen, cleveren Setup-Techniken und einer kamerabereiten Küche.",
            "Lass deinen Content besser aussehen und klingen mit praktischen Tipps zu Licht, Ton, Bildausschnitt und Präsentation.",
            "Verwandle dein Material in fesselnden Content mit starken Hooks, einfachen Schnitttechniken, Captions, Musik und dem letzten Schliff.",
          ],
          id: [
            "Syuting dengan percaya diri menggunakan tools sederhana, teknik setup cerdas, dan dapur yang siap kamera.",
            "Buat kontenmu terlihat dan terdengar lebih baik dengan tips praktis pencahayaan, audio, framing, dan presentasi.",
            "Ubah rekamanmu menjadi konten menarik dengan hook kuat, teknik editing sederhana, caption, musik, dan sentuhan akhir.",
          ],
        },
        lessons: [
          _lesson("m3-2-l1", "carousel", { en: "Sharpen your tools", de: "Werkzeuge schärfen", id: "Asah peralatanmu" }, { cards: 5 }),
          _lesson("m3-2-l2", "video", { en: "Plate the shot & prep like a pro", de: "Den Shot anrichten & profihaft vorbereiten", id: "Tata shot & prep seperti pro" }, { dur: 90 }),
          _lesson("m3-2-l3", "video", { en: "Clean kitchen & set the stage", de: "Saubere Küche & Bühne bereiten", id: "Dapur bersih & siapkan panggung" }, { dur: 60 }),
          _lesson("m3-2-l4", "video", { en: "Light it right", de: "Richtig beleuchten", id: "Cahayai dengan benar" }, { dur: 60 }),
          _lesson("m3-2-l5", "video", { en: "Season your sound", de: "Würze deinen Sound", id: "Bumbui suaramu" }, { dur: 60 }),
          _lesson("m3-2-l6", "video", { en: "Your first bite matters: Hooks", de: "Der erste Bissen zählt: Hooks", id: "Gigitan pertama penting: Hooks" }, { dur: 90 }),
          _lesson("m3-2-l7", "video", { en: "Edit like a pro", de: "Schneiden wie ein Profi", id: "Edit seperti pro" }, { dur: 180 }),
        ],
      },
    ],
  },
  {
    id: "m4",
    num: "4",
    thumb: "https://images.unsplash.com/photo-1466637574441-749b8f19452f?auto=format&fit=crop&w=1200&h=700&q=70&crop=entropy",
    title: { en: "Using Products Naturally", de: "Produkte natürlich einsetzen", id: "Menggunakan Produk Secara Natural" },
    intro: {
      en: "In this module, you'll learn how to feature products and services naturally within your content, while keeping your expertise, techniques, and creativity front and centre. By focusing on authenticity and transparency, you'll build trust with your audience and create content that feels genuine, valuable, and credible.",
      de: "In diesem Modul lernst du, Produkte und Dienstleistungen natürlich in deinen Content einzubinden und dabei dein Können, deine Techniken und deine Kreativität in den Mittelpunkt zu stellen. Mit Fokus auf Authentizität und Transparenz baust du Vertrauen bei deinem Publikum auf und erstellst Content, der echt, wertvoll und glaubwürdig wirkt.",
      id: "Dalam modul ini, kamu akan belajar menampilkan produk dan layanan secara natural dalam kontenmu, sambil menjaga keahlian, teknik, dan kreativitasmu tetap menjadi pusat perhatian. Dengan fokus pada autentisitas dan transparansi, kamu akan membangun kepercayaan dengan audiens dan membuat konten yang terasa tulus, berharga, dan kredibel.",
    },
    outcomes: {
      en: [
        "Feature products in a way that feels relevant and authentic to your recipes, techniques, and professional kitchen work.",
        "Build audience trust and strengthen long-term credibility.",
        "Create partnership content that adds value for viewers while keeping your food, skills, and story at the centre.",
      ],
      de: [
        "Binde Produkte so ein, dass sie relevant und authentisch zu deinen Rezepten, Techniken und deiner professionellen Küchenarbeit passen.",
        "Baue das Vertrauen deines Publikums auf und stärke deine langfristige Glaubwürdigkeit.",
        "Erstelle Partnerschafts-Content, der Zuschauern Mehrwert bietet und dabei dein Essen, dein Können und deine Geschichte in den Mittelpunkt stellt.",
      ],
      id: [
        "Tampilkan produk dengan cara yang terasa relevan dan autentik dengan resep, teknik, dan pekerjaan dapur profesionalmu.",
        "Bangun kepercayaan audiens dan perkuat kredibilitas jangka panjang.",
        "Buat konten kemitraan yang menambah nilai bagi penonton sambil menjaga makanan, keterampilan, dan ceritamu tetap menjadi pusat.",
      ],
    },
    directLessons: [
      _lesson("m4-l1", "video", { en: "Using Products Naturally", de: "Produkte natürlich einsetzen", id: "Menggunakan Produk Secara Natural" }, { dur: 90 }),
    ],
    subModules: [],
  },
  {
    id: "m5",
    num: "5",
    thumb: "https://images.unsplash.com/photo-1414235077428-338989a2e8c0?auto=format&fit=crop&w=1200&h=700&q=70&crop=entropy",
    title: { en: "Working with brands", de: "Mit Marken arbeiten", id: "Bekerja dengan brand" },
    intro: {
      en: "In this module, you'll learn how to interpret and execute Unilever Food Solutions briefs in a way that feels natural, authentic, and true to your style. From understanding key messages and product benefits to incorporating feedback and delivering against expectations, you'll discover how to create content that works for both the brand and your audience.",
      de: "In diesem Modul lernst du, Briefings von Unilever Food Solutions so zu interpretieren und umzusetzen, dass sie natürlich, authentisch und deinem Stil treu bleiben. Vom Verständnis der Kernbotschaften und Produktvorteile bis zum Einarbeiten von Feedback und dem Erfüllen von Erwartungen entdeckst du, wie du Content erstellst, der für die Marke und dein Publikum funktioniert.",
      id: "Dalam modul ini, kamu akan belajar menafsirkan dan menjalankan brief Unilever Food Solutions dengan cara yang terasa natural, autentik, dan sesuai gayamu. Dari memahami pesan utama dan manfaat produk hingga memasukkan feedback dan memenuhi ekspektasi, kamu akan menemukan cara membuat konten yang berhasil untuk brand dan audiensmu.",
    },
    outcomes: {
      en: [
        "Learn how to interpret creative briefs.",
        "Understand how to showcase products, services, and solutions naturally.",
        "Deliver content on-brand and in line with brand guidelines.",
        "Learn how to action feedback and refine your content.",
      ],
      de: [
        "Lerne, kreative Briefings zu interpretieren.",
        "Verstehe, wie du Produkte, Dienstleistungen und Lösungen natürlich zeigst.",
        "Liefere Content markenkonform und im Einklang mit den Markenrichtlinien.",
        "Lerne, Feedback umzusetzen und deinen Content zu verfeinern.",
      ],
      id: [
        "Pelajari cara menafsirkan brief kreatif.",
        "Pahami cara menampilkan produk, layanan, dan solusi secara natural.",
        "Sajikan konten yang sesuai brand dan panduan brand.",
        "Pelajari cara menindaklanjuti feedback dan menyempurnakan kontenmu.",
      ],
    },
    directLessons: [
      _lesson("m5-l1", "video", { en: "Working with brands", de: "Mit Marken arbeiten", id: "Bekerja dengan brand" }, { dur: 300 }),
    ],
    subModules: [],
  },
];

function flattenModuleLessons(mod) {
  const out = [];
  let flat = 0;
  (mod.directLessons || []).forEach((lesson, li) => {
    out.push({ lesson, subModule: null, subIdx: -1, lessonIdx: li, flatIdx: flat++ });
  });
  (mod.subModules || []).forEach((sm, si) => {
    (sm.lessons || []).forEach((lesson, li) => {
      out.push({ lesson, subModule: sm, subIdx: si, lessonIdx: li, flatIdx: flat++ });
    });
  });
  return out;
}

function moduleLessonCount(mod) {
  let n = (mod.directLessons || []).length;
  (mod.subModules || []).forEach(sm => { n += (sm.lessons || []).length; });
  return n;
}

function loadCurriculum() {
  return Promise.resolve(CURRICULUM);
}

window.CURRICULUM = CURRICULUM;
window.flattenModuleLessons = flattenModuleLessons;
window.moduleLessonCount = moduleLessonCount;
window.loadCurriculum = loadCurriculum;
window.LESSON_COMPLETION = LESSON_COMPLETION;
