<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;

/**
 * InPractice — Marketing Generic Cases [06/10]
 * Campaign Planning: MG-CP-06
 * Pricing & Consumer Psychology: MG-PC-01 to MG-PC-04
 *
 * Run: php artisan db:seed --class=MarketingGenericCaseSeeder_06
 */
class MarketingGenericCaseSeeder_06 extends Seeder
{
    public function run(): void
    {
        $this->command->info('📢 [06/10] Campaign Planning (6) + Pricing (1-4) ...');

        $hub   = DB::table('hubs')->where('slug', 'marketing')->first();
        $admin = DB::table('users')->where('role', 'admin')->first();

        if (! $hub || ! $admin) {
            $this->command->error('Hub or admin not found. Run HubSeeder and AdminSeeder first.');
            return;
        }

        $hubId   = $hub->id;
        $adminId = $admin->id;
        $now     = now();


        $cases = [

        // ── MG-CP-06 ──────────────────────────────────────────────────
    [
        'topic_slug'    => 'campaign_planning',
        'topic_name_en' => 'Campaign Planning & Execution',
        'topic_name_ar' => 'تخطيط الحملات وتنفيذها',
        'difficulty'    => 'intermediate',
        'sort_order'    => 406,
        'read_time_minutes' => 11,

        'title_en'    => 'The Campaign That Could Not Be Measured',
        'subtitle_en' => 'Building measurement frameworks before spending the first pound',
        'situation_en' => "You are a marketing manager at **Gateway Language Schools**, a Cairo-based English language training centre with 6 branches. The school has a EGP 240,000 annual marketing budget and spends it across:\n- Outdoor billboards (3 locations): EGP 90,000/year\n- School visits (universities + corporates): EGP 48,000/year\n- Social media management + ads: EGP 60,000/year\n- Print ads in Cairo's community magazines: EGP 24,000/year\n- Referral discounts (word of mouth): EGP 18,000/year\n\nAt year end, the CEO asks: *'Which of these actually brought us students? I want to cut the ones that don't work and double down on those that do.'*\n\nYou realise you cannot answer the question. You have no attribution data.",
        'challenge_questions_en' => json_encode([
            "Why is 'which channel brings us students' a harder question to answer than it sounds — what makes multi-channel attribution difficult for a language school?",
            "Design a measurement framework for Gateway Language Schools that can be implemented with no additional technology budget — using only current tools (WhatsApp, Excel, phone, front desk).",
            "Which of the 5 current channels is hardest to measure — and what is the right way to evaluate whether to keep it even without direct attribution data?",
            "If you had EGP 20,000 to invest in measurement infrastructure, what would you buy or build — and how would it change your ability to optimise the marketing budget?",
        ]),
        'solution_en' => "## Marketing Measurement: You Cannot Optimise What You Cannot Measure\n\n### Why Attribution Is Hard for a Language School\n\nA student's journey to enrolment may look like:\n1. Sees a billboard → doesn't act\n2. A friend mentions the school → gets curious\n3. Sees a Facebook ad → visits the website\n4. WhatsApps to ask about fees → receives a brochure\n5. Visits the school → enrols 2 weeks later\n\nWhich channel gets credit? All five touched the decision. None of them individually was sufficient. Without a deliberate tracking system, Gateway cannot answer the CEO's question — and the CEO is right to ask it.\n\n### A Zero-Budget Measurement Framework\n\n**Tool 1 — Enrolment intake form (mandatory, front desk)**\nAdd two questions to every student enrolment form:\n- 'How did you first hear about Gateway?' (Billboard / Friend referral / Facebook/Instagram / Google / School visit / Print / Other)\n- 'What was the main reason you chose Gateway?' (Location / Price / Reputation / Specific teacher / Course structure / Other)\n\nThis captures self-reported attribution. It is imperfect (students often remember the last touchpoint, not the first) but it is directionally accurate and costs nothing.\n\n**Tool 2 — Unique WhatsApp numbers by channel**\nGateway has 5 channels. Create 5 WhatsApp numbers (or use one number with different published URLs that tag the source):\n- Billboards: one number printed on boards\n- Facebook ads: a link-in-bio that tags the source\n- Print ads: a different number in the ad\n- School visit hand-outs: another number on the flyer\n\nEvery WhatsApp contact is automatically channel-attributed before the first message is sent.\n\n**Tool 3 — Monthly enrolment tracking by source (Excel)**\nA simple table: Month | Channel | Enquiries | Enrolments | Revenue\nUpdate weekly. After 6 months, patterns will be clear.\n\n**Tool 4 — Referral code system**\nFor the referral discount programme: give every student a unique referral code (their student ID). When a new student enrols and quotes the code, both are rewarded. Now referral tracking is exact — not estimated.\n\n### Evaluating the Hardest-to-Measure Channel: Outdoor Billboards\n\nBillboards are the hardest to attribute because they have no digital tracking. But 'cannot directly attribute' ≠ 'not working.'\n\nEvaluation methods without attribution:\n1. **Awareness survey:** Ask 50 enrolled students if they have seen the Gateway billboard. If 80%+ say yes, it is creating awareness (even if it is not the primary driver of enrolment)\n2. **Control period:** Turn off one billboard for one month. Measure if enquiry volume drops in that catchment area. This is a simple holdout test without technology.\n3. **Location analysis:** Plot which billboard is closest to each branch. Is enrolment stronger at branches near billboards vs. those without?\n\n### EGP 20,000 Measurement Infrastructure Investment\n\n| Investment | Cost | What It Enables |\n|---|---|---|\n| CRM system (e.g. HubSpot free tier + setup) | EGP 8,000 | Every lead tracked from source to enrolment |\n| Dedicated phone numbers per channel (virtual) | EGP 3,600/year | Call attribution by channel |\n| Website analytics setup (GA4 + heatmaps) | EGP 4,000 | Which pages and sources drive form submissions |\n| Monthly data analysis (4 hours/month) | EGP 4,400 | Turn data into decisions |\n\nWith this infrastructure, Gateway can answer the CEO's question within 3 months of implementation — and cut underperforming channels with data, not opinion.",

        'bigger_lesson_en' => "**Marketing without measurement is opinion dressed as strategy.**\n\nEvery pound of marketing budget deserves a theory of how it will lead to revenue — and a way to test whether the theory is right. The measurement framework does not need to be expensive. It needs to be built before the money is spent, not after the CEO asks why it didn't work.",

        'skills_taught_en' => json_encode([
            'Marketing measurement framework design',
            'Low-budget attribution methods',
            'CRM basics for marketing tracking',
            'Channel performance evaluation',
            'Marketing ROI accountability',
        ]),

        'title_ar'    => 'الحملة التي لم يمكن قياسها',
        'subtitle_ar' => 'بناء أطر القياس قبل إنفاق الجنيه الأول',
        'situation_ar' => "أنت مدير تسويق في **جيتواي للغات**، مركز تدريب لغة إنجليزية بالقاهرة بـ6 فروع. ميزانية تسويق سنوية 240,000 جنيه موزعة على:\n- لوحات خارجية: 90,000/سنة\n- زيارات مدارس وشركات: 48,000/سنة\n- سوشيال ميديا + إعلانات: 60,000/سنة\n- إعلانات مجلات: 24,000/سنة\n- خصومات إحالة: 18,000/سنة\n\nفي نهاية العام يسأل الرئيس: *'أيها جاءنا بالطلاب؟ أريد قطع ما لا يعمل ومضاعفة ما يعمل.'*\n\nتدرك أنك لا تستطيع الإجابة. لا بيانات نسب لديك.",
        'challenge_questions_ar' => json_encode([
            "لماذا سؤال 'أي قناة أتت بطلاب' أصعب مما يبدو — ما الذي يجعل النسب متعدد القنوات صعباً لمركز لغات؟",
            "صمم إطار قياس لجيتواي للغات يمكن تطبيقه بلا ميزانية تقنية إضافية.",
            "أي القنوات الخمس الأصعب قياساً — وما الطريقة الصحيحة لتقييم ما إذا كان يجب الإبقاء عليها؟",
            "إذا امتلكت 20,000 جنيه للاستثمار في بنية القياس، ماذا تشتري أو تبني؟",
        ]),
        'solution_ar' => "## قياس التسويق: لا يمكنك تحسين ما لا تقيسه\n\n### إطار قياس بلا ميزانية إضافية\n\n**الأداة 1 — نموذج الاستيعاب (إلزامي في الاستقبال)**\nسؤالان لكل طالب:\n- 'كيف سمعت عن جيتواي أول مرة؟' (لوحة / صديق / فيسبوك / جوجل / زيارة مدرسة / مجلة / أخرى)\n- 'ما السبب الرئيسي لاختيارك جيتواي؟'\n\n**الأداة 2 — أرقام واتساب مخصصة لكل قناة**\nرقم مختلف على كل لوحة، في إعلانات الفيسبوك، في الإعلانات المطبوعة\n\n**الأداة 3 — تتبع الاستيعاب الشهري بالإكسل**\nجدول: الشهر | القناة | الاستفسارات | الاستيعابات | الإيرادات\n\n**الأداة 4 — نظام كود الإحالة**\nكود فريد لكل طالب (رقم هويته) — حين يُسجَّل طالب جديد بالكود، يكافأ كلاهما",

        'bigger_lesson_ar' => "**التسويق بلا قياس رأي يرتدي زي الاستراتيجية.**\n\nكل جنيه من ميزانية التسويق يستحق نظرية عن كيفية توصيله للإيرادات — وطريقة لاختبار ما إذا كانت النظرية صحيحة. إطار القياس لا يحتاج تكلفة باهظة. يحتاج البناء قبل إنفاق المال لا بعد سؤال الرئيس لماذا لم ينجح.",

        'skills_taught_ar' => json_encode([
            'تصميم إطار قياس التسويق',
            'طرق النسب منخفضة التكلفة',
            'أساسيات CRM لتتبع التسويق',
            'تقييم أداء القنوات',
            'مساءلة عائد الاستثمار التسويقي',
        ]),
        'created_at' => $now,
        'updated_at' => $now,
    ],

    // ══════════════════════════════════════════════════════════════
    //  TOPIC 5 — PRICING & CONSUMER PSYCHOLOGY (6 cases)
    // ══════════════════════════════════════════════════════════════

        // ── MG-PC-01 ──────────────────────────────────────────────────
    [
        'topic_slug'    => 'pricing_psychology',
        'topic_name_en' => 'Pricing & Consumer Psychology',
        'topic_name_ar' => 'التسعير وسيكولوجية المستهلك',
        'difficulty'    => 'beginner',
        'sort_order'    => 501,
        'read_time_minutes' => 10,

        'title_en'    => 'The Price That Sells More at EGP 199 Than EGP 200',
        'subtitle_en' => 'The science of charm pricing and psychological price anchoring',
        'situation_en' => "You are a junior marketer at **Azza Boutique**, a Cairo-based women's clothing brand selling through Instagram and a small showroom in Dokki. Your manager has been pricing products at round numbers: EGP 200, EGP 300, EGP 450.\n\nA colleague suggests changing all prices to 'charm prices': EGP 199, EGP 299, EGP 449. Your manager is sceptical: *'Nobody is fooled by that anymore. It's one pound difference. Why would it change anything?'*\n\nYou are asked to make the case for or against charm pricing — with evidence.",
        'challenge_questions_en' => json_encode([
            "What is charm pricing and what psychological mechanism makes EGP 199 genuinely feel different from EGP 200 — even when buyers consciously know the difference is one pound?",
            "Your manager says 'nobody is fooled anymore.' What does the research actually say about charm pricing effectiveness — and does it apply equally to all product categories and price ranges?",
            "Charm pricing is one of many price psychology techniques. Describe two others (price anchoring and decoy pricing) with an Egyptian retail example for each.",
            "Design a pricing structure for Azza Boutique's next collection using at least three price psychology principles — with a specific rationale for each product tier.",
        ]),
        'solution_en' => "## Price Psychology: How the Brain Processes Price Before Logic Does\n\n### The Psychology Behind Charm Pricing\n\nCharm pricing works because of a cognitive phenomenon called **left-digit anchoring**. The human brain processes numbers from left to right and disproportionately weights the first digit it encounters.\n\nWhen a consumer sees EGP 199:\n- The brain first registers '1' — placing the item mentally in the 'hundred range'\n- The subconscious categorises it as 'less than 200'\n- Only then does rational processing catch up\n\nWhen a consumer sees EGP 200:\n- The brain first registers '2' — placing it in the 'two hundred range'\n- It feels categorically more expensive, even though the difference is 0.5%\n\n**Research finding:** A study across 86 clothing retailers found that charm-priced items ($39 vs $40) outsold round-number priced items by an average of 24% — even among consumers who explicitly stated they were not influenced by charm pricing.\n\n### When Charm Pricing Works vs. When It Doesn't\n\n| Charm Pricing Works | Charm Pricing Doesn't Work |\n|---|---|\n| Mass market and mid-range products | Ultra-luxury products (EGP 4,999 feels cheap vs EGP 5,000) |\n| Online and e-commerce environments | Professional B2B services (feels unserious) |\n| Competitive, price-sensitive categories | High-trust, professional services |\n| Unknown or new brands | Well-established prestige brands |\n\nFor Azza Boutique — a mid-range Instagram boutique — charm pricing is appropriate and evidentially effective.\n\n### Two Other Pricing Psychology Techniques\n\n**Price Anchoring — Egyptian retail example:**\nA perfume shop displays: Perfume A at EGP 1,200 / Perfume B at EGP 650 / Perfume C at EGP 380\n\nPerfume A is the 'anchor' — it is placed first to make EGP 650 feel reasonable by comparison. Most shoppers buy Perfume B, even though they came in with a EGP 300 budget. The anchor shifted their frame of reference upward.\n\n**Decoy Pricing — Egyptian retail example:**\nA gym offers: Monthly EGP 450 / 3-month EGP 1,100 / Annual EGP 2,400\n\nThe 3-month option is the 'decoy' — it exists to make the annual plan feel like extraordinary value (EGP 200/month vs EGP 450/month). Without the decoy, most people would choose monthly. With it, annual enrolments increase by 30–40%.\n\n### Azza Boutique's Collection Pricing Strategy\n\n**Tier 1 — Entry pieces (basics, accessories)**\nPricing: EGP 149, EGP 179, EGP 199\nPrinciple: Charm pricing — all below the EGP 200 psychological threshold\nRationale: Makes the collection feel accessible, draws first-time buyers in\n\n**Tier 2 — Mid-range (seasonal statement pieces)**\nPricing: EGP 349, EGP 449\nPrinciple: Charm pricing + anchor effect (the EGP 449 piece makes EGP 349 feel reasonable)\nRationale: The most frequently purchased tier — optimised for conversion\n\n**Tier 3 — Premium (signature/limited pieces)**\nPricing: EGP 750, EGP 950\nPrinciple: Deliberate round numbers at the premium tier signal confidence and quality\nRationale: At premium price points, charm pricing can undermine perceived luxury. EGP 950 signals 'this is worth EGP 950' more than EGP 949.\n\n**Bundle pricing:**\nOffer: 'Any 2 Tier 1 pieces for EGP 280' (vs. EGP 298 if bought separately)\nPrinciple: Bundle discount + savings framing (buyer feels they're getting a deal)\nRationale: Increases average order value while the buyer feels they're winning",

        'bigger_lesson_en' => "**Pricing is not arithmetic — it is psychology.**\n\nThe 'rational consumer' who always calculates value and ignores price presentation does not exist. Every human brain uses shortcuts, anchors, and category heuristics to process price. Understanding these mechanisms is not manipulation — it is honest marketing practice. The goal is to price in a way that accurately communicates the value of what you sell, using the language the brain actually speaks.",

        'skills_taught_en' => json_encode([
            'Charm pricing and left-digit anchoring',
            'Price anchoring strategy',
            'Decoy pricing technique',
            'Product tiering and price architecture',
            'Consumer price psychology principles',
        ]),

        'title_ar'    => 'السعر الذي يبيع أكثر بـ199 جنيه من 200 جنيه',
        'subtitle_ar' => 'علم التسعير الساحر وربط الأسعار النفسي',
        'situation_ar' => "أنت مسوق مبتدئ في **عزة بوتيك**، علامة ملابس نسائية قاهرية تبيع عبر إنستغرام وصالة عرض صغيرة في الدقي. مديرتك تسعّر بأرقام كاملة: 200 و300 و450 جنيه.\n\nزميل يقترح تغيير الأسعار لـ'أسعار سحرية': 199 و299 و449 جنيه. المديرة متشككة: *'لا أحد ينخدع بذلك. فرق جنيه واحد. لماذا يغيّر شيئاً؟'*\n\nطُلب منك تقديم الحجة مع الأدلة.",
        'challenge_questions_ar' => json_encode([
            "ما التسعير الساحر وما الآلية النفسية التي تجعل 199 جنيه يبدو مختلفاً فعلاً عن 200 جنيه؟",
            "مديرتك تقول 'لا أحد ينخدع بعد الآن'. ماذا تقول الأبحاث الفعلية عن فعالية التسعير الساحر؟",
            "صف تقنيتين أخريين لسيكولوجية التسعير (ربط السعر والسعر الطعم) مع مثال مصري لكل منهما.",
            "صمم هيكل تسعير لمجموعة عزة بوتيك القادمة باستخدام 3 مبادئ سيكولوجية للتسعير.",
        ]),
        'solution_ar' => "## سيكولوجية التسعير: كيف يعالج الدماغ السعر قبل المنطق\n\n### الآلية النفسية وراء التسعير الساحر\n\n**ربط الرقم الأيسر:** الدماغ يعالج الأرقام من اليسار لليمين ويُعطي وزناً غير متناسب لأول رقم.\n\nحين يرى المستهلك 199: الدماغ يسجّل أولاً '1' — يُصنّفه في 'نطاق المئة'\nحين يرى 200: الدماغ يسجّل '2' — يبدو أغلى بشكل فئوي\n\n**نتيجة بحثية:** عبر 86 متجر ملابس، التسعير الساحر فاق التسعير بأرقام كاملة بمتوسط 24%.\n\n### هيكل تسعير عزة بوتيك\n\n**الطبقة الأولى (قطع أساسية):** 149 و179 و199 — أسعار سحرية دون عتبة 200 جنيه\n**الطبقة الثانية (قطع موسمية):** 349 و449 — تسعير ساحر + تأثير المرساة\n**الطبقة الثالثة (قطع مميزة):** 750 و950 — أرقام كاملة مقصودة تُشير للجودة والثقة\n**باقات:** '2 قطع من الطبقة الأولى بـ280' (مقابل 298 جنيه فردياً)",

        'bigger_lesson_ar' => "**التسعير ليس حسابات — إنه سيكولوجيا.**\n\n'المستهلك العقلاني' الذي يحسب القيمة دائماً ويتجاهل عرض السعر غير موجود. كل دماغ بشري يستخدم اختصارات ومراسي وإرشادات فئوية لمعالجة السعر. فهم هذه الآليات ليس تلاعباً — بل ممارسة تسويقية صادقة.",

        'skills_taught_ar' => json_encode([
            'التسعير الساحر وربط الرقم الأيسر',
            'استراتيجية ربط السعر',
            'تقنية السعر الطعم',
            'تدرج المنتجات وهيكل التسعير',
            'مبادئ سيكولوجية المستهلك السعرية',
        ]),
        'created_at' => $now,
        'updated_at' => $now,
    ],

        // ── MG-PC-02 ──────────────────────────────────────────────────
    [
        'topic_slug'    => 'pricing_psychology',
        'topic_name_en' => 'Pricing & Consumer Psychology',
        'topic_name_ar' => 'التسعير وسيكولوجية المستهلك',
        'difficulty'    => 'intermediate',
        'sort_order'    => 502,
        'read_time_minutes' => 11,
        'title_en'    => 'The Subscription Price Nobody Cancelled',
        'subtitle_en' => 'Designing pricing that builds loyalty through psychology, not lock-in',
        'situation_en' => "You are a marketing manager at **ReadArabic**, an Egyptian digital platform offering Arabic audiobooks and e-books by subscription. Current pricing:\n- Monthly: EGP 79/month\n- Annual: EGP 790/year (saves EGP 158 vs monthly)\n\nOf 12,400 active subscribers: 78% are monthly, 22% are annual.\nMonthly churn rate: 9.4% (industry average: 5–7%).\nAnnual renewal rate: 71% (industry average: 80–85%).\n\nThe CFO notes: 'Every monthly subscriber who churns cost us EGP 79 to acquire and we kept them for 3.2 months on average. Every annual subscriber stays 18+ months on average. We need more annual subscribers.'\n\nDesign a pricing and psychology strategy to shift the ratio from 78/22 to 50/50 within 12 months — without raising prices.",
        'challenge_questions_en' => json_encode([
            "Why do consumers default to monthly even when annual is mathematically better value — what psychological friction is blocking annual subscription choice?",
            "The annual plan saves EGP 158. Is this saving framed in the most persuasive way — and how would you reframe it to maximise conversion to annual?",
            "Design 5 psychological interventions that would shift monthly subscribers to annual — without changing the price of either plan.",
            "The 9.4% monthly churn is almost double the industry average. What are the most likely causes — and design a churn intervention programme.",
        ]),
        'solution_en' => "## Subscription Psychology: Designing for Long-Term Commitment\n\n### Why Consumers Default to Monthly\n\n**Loss aversion:** EGP 790 upfront *feels* like a larger loss than EGP 79/month, even though it is less money total. The brain treats the annual payment as a significant outlay, even when calculating it is better value.\n\n**Uncertainty about future use:** 'What if I stop reading after 2 months? I'll have wasted EGP 790.' Monthly feels safer because the commitment is smaller.\n\n**Inertia:** Once on monthly, auto-renewal keeps them there. They never consciously reconsider.\n\n### Reframing the Annual Saving\n\nCurrent framing: 'Annual plan: EGP 790 (saves EGP 158)'\n\nProblem: EGP 158 saving in abstract feels small. EGP 790 upfront feels large.\n\n**Better framings:**\n- 'EGP 65.8/month — that's 2 months free' (monthly equivalent makes the saving feel immediate)\n- 'Annual plan: pay for 10, read for 12' (concrete, intuitive framing)\n- 'Less than one coffee per week' (relativity anchor against something familiar)\n- 'Your next 365 days of reading — secured' (abundance framing, not saving framing)\n\n### Five Psychological Interventions\n\n**Intervention 1 — Annual default on sign-up page**\nChange the subscription page to show Annual as the pre-selected option. Monthly requires an active choice to 'downgrade.' Research: default options increase uptake by 20–30%.\n\n**Intervention 2 — Progress anchoring at month 3**\nAt 3 months, send a personalised email: 'You've listened to 8 audiobooks and read 3 e-books in 3 months with ReadArabic. Imagine 12 months.' Show their listening stats. Then offer the annual upgrade: 'Lock in your reading year — and get 2 months free.'\n\n**Intervention 3 — Mid-year offer (July only)**\nSend monthly subscribers a time-limited offer: 'Switch to annual today and we'll extend your year to include 2 extra months — for the same price. Offer ends July 31.' Urgency + bonus.\n\n**Intervention 4 — Annual-only features (light)**\nGive annual subscribers one genuinely useful exclusive: offline access to 5 books/month, or a 'Reading Year in Review' summary. Not a hard lock-in — a genuine thank-you that monthly subscribers notice.\n\n**Intervention 5 — Social proof framing**\n'Join 2,728 Egyptian readers who chose the annual plan last month' — visible on the pricing page. Social proof at the moment of decision.\n\n### Churn Intervention Programme (9.4% → <6%)\n\n**Cause 1 — Low engagement before churn:** Most churn happens to subscribers who stopped using the platform 2–3 weeks before cancelling.\n- Solution: Trigger an engagement email when a subscriber hasn't logged in for 14 days: 'We saved some new books for you' + personalised recommendations\n\n**Cause 2 — Price shock at renewal:** Monthly subscribers sometimes forget they have a subscription until the charge appears.\n- Solution: Send a reminder 3 days before renewal with usage stats: 'This month you listened to 4 hours of Arabic literature — your subscription renews in 3 days'\n\n**Cause 3 — No save flow at cancellation:**\n- When a subscriber clicks 'cancel,' show them: usage summary + a 3-month pause option + a reduced offer (EGP 49/month for 3 months if they stay). Most subscription services recover 20–30% of cancellations with a good save flow.",

        'bigger_lesson_en' => "**Subscription businesses win or die on churn. Every 1% reduction in monthly churn is worth more to the business than acquiring 20% more new subscribers.**\n\nThe goal of subscription pricing psychology is not to trick people into staying — it is to remove the friction that causes people to leave who would have stayed if they had been reminded of the value they were getting.",

        'skills_taught_en' => json_encode([
            'Subscription pricing psychology',
            'Annual vs monthly plan conversion strategy',
            'Churn reduction interventions',
            'Price framing and reframing',
            'Default effect and choice architecture',
        ]),

        'title_ar'    => 'سعر الاشتراك الذي لا يُلغيه أحد',
        'subtitle_ar' => 'تصميم تسعير يبني الولاء من خلال السيكولوجيا لا القيود',
        'situation_ar' => "أنت مدير تسويق في **ريد عربيك**، منصة رقمية مصرية تقدم كتباً صوتية وإلكترونية عربية بالاشتراك. التسعير الحالي:\n- شهري: 79 جنيه/شهر\n- سنوي: 790 جنيه/سنة (يوفر 158 جنيه)\n\nمن 12,400 مشترك نشط: 78% شهريون، 22% سنويون.\nمعدل تراجع شهري: 9.4% (متوسط الصناعة: 5-7%).\n\nيقول المدير المالي: 'كل مشترك شهري يتراجع كلّفنا 79 جنيه للاستقطاب وبقي 3.2 شهر. كل مشترك سنوي يبقى 18+ شهراً. نحتاج المزيد من السنويين.'\n\nصمم استراتيجية تسعير وسيكولوجيا لتغيير النسبة من 78/22 إلى 50/50 في 12 شهراً — دون رفع الأسعار.",
        'challenge_questions_ar' => json_encode([
            "لماذا يتجه المستهلكون افتراضياً للشهري حتى حين يكون السنوي أفضل قيمة رياضياً؟",
            "السنوي يوفر 158 جنيه. هل هذا التوفير مُصاغ بأكثر الطرق إقناعاً — وكيف تعيد صياغته؟",
            "صمم 5 تدخلات نفسية لتحويل المشتركين الشهريين للسنوي — دون تغيير سعر أي خطة.",
            "معدل التراجع الشهري 9.4% ضعف المتوسط الصناعي تقريباً. ما الأسباب المحتملة وصمم برنامج تدخل لخفضه؟",
        ]),
        'solution_ar' => "## سيكولوجية الاشتراك: التصميم للالتزام طويل الأمد\n\n### خمسة تدخلات نفسية\n\n1. **السنوي افتراضياً في صفحة الاشتراك** — الشهري يتطلب اختياراً نشطاً للتراجع (+20-30% اتخاذ)\n2. **ربط التقدم عند الشهر 3** — بريد مخصص: '8 كتب صوتية في 3 أشهر... تخيل 12 شهراً. اقفل سنة قراءتك.'\n3. **عرض منتصف العام (يوليو فقط)** — 'حوّل لسنوي اليوم واحصل على شهرين إضافيين' + إلحاح\n4. **ميزات حصرية للسنويين** — وصول غير متصل لـ5 كتب/شهر (ليس قيداً — شكر حقيقي)\n5. **إثبات اجتماعي** — '2,728 قارئ مصري اختاروا السنوي الشهر الماضي' على صفحة التسعير\n\n### برنامج خفض التراجع\n\n- بريد تفاعل عند 14 يوم بدون تسجيل دخول\n- تذكير بتجديد قبل 3 أيام مع إحصاءات الاستخدام\n- تدفق إنقاذ عند الإلغاء: خيار التوقف 3 أشهر + عرض مخفض (49 جنيه/شهر لـ3 أشهر)",

        'bigger_lesson_ar' => "**أعمال الاشتراك تكسب أو تخسر بمعدل التراجع. كل انخفاض 1% في التراجع الشهري يساوي أكثر من استقطاب 20% مشتركين جدد.**\n\nهدف سيكولوجية التسعير الاشتراكي ليس خداع الناس للبقاء — بل إزالة الاحتكاك الذي يجعل من سيبقى لو ذُكّر بالقيمة يغادر.",

        'skills_taught_ar' => json_encode([
            'سيكولوجية تسعير الاشتراك',
            'استراتيجية التحويل للسنوي',
            'تدخلات خفض التراجع',
            'إطار السعر وإعادة صياغته',
            'التأثير الافتراضي وهندسة الاختيار',
        ]),
        'created_at' => $now,
        'updated_at' => $now,
    ],

        // ── MG-PC-03 to MG-PC-06 (4 more pricing cases, structured similarly)
    // For brevity in this part, including 3 more pricing + starting content/social

    [
        'topic_slug'    => 'pricing_psychology',
        'topic_name_en' => 'Pricing & Consumer Psychology',
        'topic_name_ar' => 'التسعير وسيكولوجية المستهلك',
        'difficulty'    => 'intermediate',
        'sort_order'    => 503,
        'read_time_minutes' => 12,
        'title_en'    => 'The Discount That Devalued the Brand',
        'subtitle_en' => 'Why promotions can permanently damage brand equity — and how to promote without destroying value',
        'situation_en' => "You are the brand manager at **Mira Fashion**, a mid-market Egyptian women's wear brand. Sales have been stagnant for 8 months. The commercial team's solution: run a 30% discount for all online orders every weekend.\n\nFour months later:\n- Weekend revenue is up 40%\n- Weekday revenue is down 52%\n- Average selling price has dropped from EGP 320 to EGP 241\n- 67% of online orders now come on discount weekends\n- Customers have started waiting for the discount before buying\n- Brand perception surveys show 'value for money' scores have increased but 'premium feel' scores have dropped 31%\n\nThe commercial team says 'the promotion is working — sales are up.' The brand team says 'the brand is dying.' They are both right.",
        'challenge_questions_en' => json_encode([
            "Explain the commercial team's argument and the brand team's argument. In what sense are both correct?",
            "What is 'promotional dependency' and how does it explain why weekday sales dropped 52% while weekend sales rose 40%?",
            "What is the difference between a tactical promotion and a strategic one — and which type is this?",
            "Design a 6-month exit plan from the discount cycle that maintains revenue while rebuilding brand equity and price integrity.",
        ]),
        'solution_en' => "## The Promotion Trap: When the Discount Becomes the Price\n\n### Both Arguments Are Right\n\n**Commercial team is right:** Weekend revenue is up 40%. Total revenue has likely not collapsed. The promotion is generating transactions.\n\n**Brand team is right:** The average selling price has dropped from EGP 320 to EGP 241 — a 25% permanent price reduction disguised as a temporary promotion. The brand's 'premium feel' score has dropped 31%. The brand is being trained to be perceived as a discount brand.\n\n### Promotional Dependency\n\nWhen consumers learn that a brand discounts reliably — every weekend, every month-end, every Eid — they stop buying at full price. They wait. This is called **promotional dependency** or 'deal training.'\n\nThe result: the brand's real price is no longer EGP 320 — it is EGP 224 (EGP 320 × 70%). The full price has become an artificial anchor that no one pays. Weekday sales dropped 52% because customers who would previously buy at EGP 320 are now waiting for the weekend.\n\n### Tactical vs. Strategic Promotion\n\n| Tactical Promotion | Strategic Promotion |\n|---|---|\n| Clears excess inventory | Recruits new customers |\n| Time-limited, not habitual | Tied to a specific occasion or behaviour |\n| Not communicated in advance | Surprise element preserves full-price purchases |\n| Protects full-price integrity | Protects full-price integrity |\n| Example: End-of-season 40% off everything | Example: First-time app purchase 20% off |\n\nMira's weekend promotion is tactical behaviour used habitually — the worst combination.\n\n### 6-Month Exit Plan\n\n**Month 1–2: Reduce frequency**\nMove from 'every weekend' to 'first weekend of each month.' Announce it as an enhancement: 'Mira Monthly Exclusive.' This halves the promotional period while maintaining the habit for customers who are dependent.\n\n**Month 2–3: Shift from discount to value-add**\nReplace price discount with value additions: 'This weekend — free gift wrap + next-day delivery on all orders' instead of 30% off. This maintains the 'reason to buy on weekends' without dropping the price.\n\n**Month 3–4: Introduce a loyalty programme**\nLaunch 'Mira Rewards': points on every purchase, redeemable for gifts or upgrades (not discounts). This shifts the customer's attention from 'how much is the discount' to 'how many points am I earning.'\n\n**Month 4–6: Remove weekend discount entirely**\nReplace with seasonal events: Ramadan collection, summer launch, back-to-school — specific, occasion-linked promotions that feel like events, not habits. These are strategically scheduled so customers cannot predict and wait for them.\n\n**New pricing integrity rule:** No discount deeper than 20% except end-of-season clearance. Any promotion must have a clear start and end date communicated to customers.",

        'bigger_lesson_en' => "**Every discount is a vote against your own price.**\n\nA brand that discounts habitually is telling its customers: 'Our regular price is not the right price.' Once customers believe this, full-price sales become structurally impossible. The exit from promotional dependency is slow and painful — the entry into it is fast and easy. Protect price integrity from the first promotion.",

        'skills_taught_en' => json_encode([
            'Promotional dependency and deal training',
            'Brand equity vs. sales volume trade-off',
            'Tactical vs. strategic promotion design',
            'Pricing integrity protection',
            'Exit strategy from discount cycles',
        ]),

        'title_ar'    => 'الخصم الذي قلّل قيمة العلامة',
        'subtitle_ar' => 'لماذا يمكن أن تضر العروض الترويجية بشكل دائم بقيمة العلامة',
        'situation_ar' => "أنت مدير علامة في **ميرا فاشون**. المبيعات راكدة 8 أشهر. حل الفريق التجاري: خصم 30% على جميع الطلبات الأونلاين كل عطلة نهاية أسبوع.\n\nبعد 4 أشهر:\n- إيرادات نهاية الأسبوع ارتفعت 40%\n- إيرادات أيام الأسبوع انخفضت 52%\n- سعر البيع المتوسط انخفض من 320 إلى 241 جنيه\n- 67% من الطلبات تأتي في عطلات الخصم\n- المستهلكون بدأوا ينتظرون الخصم قبل الشراء\n\nالفريق التجاري يقول 'العرض ينجح'. فريق العلامة يقول 'العلامة تحتضر'. كلاهما على حق.",
        'challenge_questions_ar' => json_encode([
            "اشرح حجة الفريق التجاري وحجة فريق العلامة. بأي معنى كلاهما صحيح؟",
            "ما 'التبعية الترويجية' وكيف تفسر لماذا انخفضت مبيعات أيام الأسبوع 52% بينما ارتفعت نهاية الأسبوع 40%؟",
            "ما الفرق بين العرض التكتيكي والاستراتيجي — وأيهما هذا؟",
            "صمم خطة خروج من دورة الخصم لـ6 أشهر تحافظ على الإيرادات مع إعادة بناء قيمة العلامة ونزاهة السعر.",
        ]),
        'solution_ar' => "## فخ العروض الترويجية: حين يصبح الخصم هو السعر\n\n### خطة خروج 6 أشهر\n\n**الشهر 1-2:** تقليل التكرار — من كل عطلة إلى أول عطلة شهرياً\n**الشهر 2-3:** تحويل من خصم سعر لإضافة قيمة (توصيل مجاني + هدية)\n**الشهر 3-4:** إطلاق برنامج ولاء 'ميرا ريواردز' — نقاط لا خصومات\n**الشهر 4-6:** استبدال عطلة الخصم بأحداث موسمية محددة لا يمكن التنبؤ بها\n\n**قاعدة نزاهة التسعير الجديدة:** لا خصم أعمق من 20% إلا في تخفيضات نهاية الموسم",

        'bigger_lesson_ar' => "**كل خصم صوت ضد سعرك الخاص.**\n\nالعلامة التي تخصّم بانتظام تقول لعملائها: 'سعرنا العادي ليس السعر الصحيح.' الخروج من التبعية الترويجية بطيء ومؤلم — الدخول إليها سريع وسهل. احمِ نزاهة السعر من أول عرض.",

        'skills_taught_ar' => json_encode([
            'التبعية الترويجية وتدريب الصفقات',
            'المقايضة بين قيمة العلامة وحجم المبيعات',
            'تصميم العرض التكتيكي مقابل الاستراتيجي',
            'حماية نزاهة التسعير',
            'استراتيجية الخروج من دورات الخصم',
        ]),
        'created_at' => $now,
        'updated_at' => $now,
    ],

        

    [
        'topic_slug'    => 'pricing_psychology',
        'topic_name_en' => 'Pricing & Consumer Psychology',
        'topic_name_ar' => 'التسعير وسيكولوجية المستهلك',
        'difficulty'    => 'advanced',
        'sort_order'    => 504,
        'read_time_minutes' => 13,
        'title_en'    => 'The Value-Based Pricing Shift',
        'subtitle_en' => 'Moving from cost-plus to what-the-market-will-pay pricing',
        'situation_en' => "You are the marketing director at **Vertex Strategy Consulting**, a boutique Egyptian management consulting firm serving mid-market companies. Current pricing: EGP 1,200/hour for all consultants.\n\nThe pricing was set 4 years ago based on: 'our costs are X, we want 60% margin, therefore EGP 1,200/hour.' No competitor analysis. No client value analysis.\n\nA new CFO challenge: one of your clients — a trading company — used your firm's 3-month supply chain project (billed at EGP 216,000) and implemented the recommendations. They saved EGP 4.8 million in the first year.\n\nThe CFO asks: 'We charged EGP 216,000 for advice worth EGP 4.8 million. That is 4.5 cents on the dollar of value created. Should we be charging more?'",
        'challenge_questions_en' => json_encode([
            "What is cost-plus pricing vs. value-based pricing — and which approach is Vertex currently using? What are the risks of each?",
            "If Vertex's advice generated EGP 4.8 million in value, what is the theoretically 'correct' range of prices they could have charged — and how would you arrive at this range?",
            "What are the practical barriers to implementing value-based pricing for a consulting firm — client resistance, pricing conversations, and internal capability?",
            "Design a transition plan for Vertex to move from hourly billing to value-based pricing over 18 months — with specific milestones and risk mitigation.",
        ]),
        'solution_en' => "## Value-Based Pricing: Charging What You Are Worth\n\n### Cost-Plus vs. Value-Based Pricing\n\n**Cost-plus pricing:** Calculate your costs, add a desired margin, set the price. Simple, internally focused, ignores market and value.\n- Risk: Systematically under-prices when value delivered is high. Over-prices when value is low. Creates no incentive to create more value.\n\n**Value-based pricing:** Estimate the economic value the customer receives, charge a share of that value.\n- Risk: Requires understanding of client economics (harder), pricing conversations (uncomfortable), and accurate value measurement (complex).\n\nVertex is using cost-plus. The EGP 4.8 million case proves they are dramatically under-pricing for high-value engagements.\n\n### The Theoretically Correct Price Range\n\nValue created: EGP 4.8 million (Year 1 savings)\nVertexed charged: EGP 216,000 = 4.5% of value\n\n**Value-based pricing framework for consulting:**\n- Minimum (below this, why engage?): 10% of year-1 value = EGP 480,000\n- Standard range: 15–25% of year-1 value = EGP 720,000 – EGP 1,200,000\n- Premium (high certainty, proprietary methodology): 30%+ = EGP 1,440,000+\n\nNote: The client would pay EGP 720,000 for EGP 4.8M in return. That is still a 6.6× ROI on their investment. The value-based price is both fair to the consultant and extraordinary value for the client.\n\n### Practical Barriers and Solutions\n\n**Barrier 1 — 'We don't know the value upfront'**\nSolution: Structured discovery phase (EGP 30,000 fixed fee) that maps the problem and estimates the value of solving it. This gives both parties a basis for value-based pricing.\n\n**Barrier 2 — Clients push back on value pricing**\nSolution: Frame it as shared risk. Offer a base fee (EGP 120,000) + success fee (15% of measured savings above threshold). The client only pays the full fee when they win. This removes resistance.\n\n**Barrier 3 — Internal pricing capability**\nConsultants are comfortable talking about hours but uncomfortable talking about value. Training required: how to have the value conversation, how to measure outcomes, how to frame the success fee.\n\n### 18-Month Transition Plan\n\n**Months 1–6: Pilot**\n- Select 3 new engagements to price on value basis\n- These must be projects where the value of success is clearly measurable (cost savings, revenue increase)\n- Price: base fee + 15% success fee\n- Maintain hourly pricing for existing clients and relationship work\n\n**Months 7–12: Learn and codify**\n- Review the 3 pilots: what worked, what the client response was, what value was actually delivered\n- Build internal playbooks: how to run a value discovery session, how to calculate value, how to present value-based pricing\n\n**Months 13–18: Systematic transition**\n- All new client proposals offered in value-based format as primary option\n- Hourly remains available as secondary option for clients who insist\n- Set minimum engagement threshold: no project under EGP 80,000 (removes unprofitable small projects)",

        'bigger_lesson_en' => "**The question is not 'what does our time cost?' — it is 'what is our advice worth?'**\n\nConsulting, law, design, engineering — all knowledge professions systematically under-price because they price time instead of outcomes. The firms that have shifted to value-based pricing consistently report 40–100% revenue increases on the same number of hours worked. The conversation is uncomfortable. The economics are undeniable.",

        'skills_taught_en' => json_encode([
            'Value-based pricing methodology',
            'Cost-plus vs. value-based pricing comparison',
            'Success fee and hybrid pricing models',
            'Value discovery and measurement',
            'Pricing transition strategy for service firms',
        ]),

        'title_ar'    => 'التحول للتسعير القائم على القيمة',
        'subtitle_ar' => 'الانتقال من التكلفة-زائد-هامش إلى ما-سيدفعه-السوق',
        'situation_ar' => "أنت مدير التسويق في **فيرتكس للاستراتيجية**، شركة استشارات إدارية مصرية متخصصة. التسعير الحالي: 1,200 جنيه/ساعة لجميع المستشارين.\n\nتحدٍّ من المدير المالي الجديد: أحد عملائكم — شركة تجارية — استخدم مشروعكم لمدة 3 أشهر (فاتورة 216,000 جنيه) ونفّذ التوصيات. وفّرت التوصيات 4.8 مليون جنيه في السنة الأولى.\n\nيسأل المدير المالي: 'قدّمنا استشارة بـ216,000 جنيه تساوي 4.8 مليون. 4.5 قرش على كل دولار من القيمة المُنشأة. هل يجب أن نُقاضيهم أكثر؟'",
        'challenge_questions_ar' => json_encode([
            "ما التسعير بالتكلفة-زائد مقابل التسعير القائم على القيمة — وأيهما تستخدم فيرتكس؟ ما مخاطر كل منهما؟",
            "إذا ولّدت نصيحة فيرتكس 4.8 مليون جنيه قيمة، ما نطاق الأسعار 'الصحيح' نظرياً الذي كان بإمكانهم تحصيله؟",
            "ما العوائق العملية لتطبيق التسعير القائم على القيمة لشركة استشارات؟",
            "صمم خطة انتقال لفيرتكس من الفوترة بالساعة للتسعير القائم على القيمة خلال 18 شهراً.",
        ]),
        'solution_ar' => "## التسعير القائم على القيمة: الفوترة بما تستحقه\n\n### نطاق السعر الصحيح نظرياً\n\nقيمة منشأة: 4.8 مليون جنيه | ما فُوتر: 216,000 = 4.5%\n\n**إطار التسعير القائم على القيمة:**\n- الحد الأدنى (10% من قيمة السنة الأولى): 480,000 جنيه\n- النطاق المعياري (15-25%): 720,000 – 1,200,000 جنيه\n- الممتاز (30%+): 1,440,000+\n\n**العميل كان سيدفع 720,000 مقابل عائد 4.8 مليون = عائد استثمار 6.6 ضعف**\n\n### خطة انتقال 18 شهراً\n\n**الأشهر 1-6:** 3 مشاريع تجريبية بنموذج تسعير هجين: رسوم أساسية + 15% رسوم نجاح\n**الأشهر 7-12:** مراجعة التجارب وبناء كتيبات داخلية\n**الأشهر 13-18:** جميع مقترحات العملاء الجدد بصيغة القيمة أولاً",

        'bigger_lesson_ar' => "**السؤال ليس 'كم تكلّف وقتنا؟' — بل 'كم تساوي نصيحتنا؟'**\n\nالمهن المعرفية — الاستشارات والقانون والتصميم والهندسة — تُقلّل أسعارها ممنهجياً لأنها تُسعّر الوقت بدل النتائج. الشركات التي تحولت للتسعير القائم على القيمة تُبلّغ باستمرار عن زيادات إيرادات 40-100% على نفس عدد الساعات.",

        'skills_taught_ar' => json_encode([
            'منهجية التسعير القائم على القيمة',
            'مقارنة التكلفة-زائد مقابل القيمة',
            'نماذج رسوم النجاح والتسعير الهجين',
            'اكتشاف القيمة وقياسها',
            'استراتيجية انتقال التسعير لشركات الخدمات',
        ]),
        'created_at' => $now,
        'updated_at' => $now,
    ],

        ]; // end file 06

          $cases = array_map(function ($case) use ($hubId, $adminId, $now) {
            return array_merge($case, [
                'hub_id'       => $hubId,
                'created_by'   => $adminId,
                'status'       => 'published',
                'published_at' => $now,
            ]);
        }, $cases);

        DB::table('cases')->insert($cases);
        $this->command->info('  ✅ 5 cases inserted (MG-CP-06, MG-PC-01 to MG-PC-04)');
    }
}
