<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use App\Models\SelfPaced\Course;
use App\Models\SelfPaced\CourseCategory;
use App\Models\SelfPaced\CourseTopic;
use App\Models\SelfPaced\CourseSubTopic;
use App\Models\SelfPaced\ExamQuestion;
use App\Models\SelfPaced\CourseDownload;
use App\Models\User;

/**
 * HealthProjectManagementCourseSeeder
 *
 * Seeds the "Professional Certificate in Health Project Management" course
 * with 8 topics, 4 subtopics each (32 total), 40 exam questions, and 2 downloads.
 * All fees in South Sudanese Pound (SSP). Fully idempotent via firstOrCreate.
 *
 * Run individually:
 *   php artisan db:seed --class=HealthProjectManagementCourseSeeder
 *
 * Requirements: 2.1–2.12, 3.1–3.5, 4.1–4.6, 5.1–5.9, 6.1–6.6, 7.1–7.5, 10.1–10.4
 */
class HealthProjectManagementCourseSeeder extends Seeder
{
    private int $createdById  = 1;
    private int $instructorId = 1;

    // -------------------------------------------------------------------------
    // ENTRY POINT
    // -------------------------------------------------------------------------

    public function run(): void
    {
        DB::transaction(function () {
            $this->resolveUsers();
            $course = $this->makeCourse();
            $this->seedTopics($course);
            $this->seedQuestions($course);
            $this->seedDownloads($course);
        });

        $this->command->info('HealthProjectManagementCourseSeeder: course seeded successfully.');
    }

    // -------------------------------------------------------------------------
    // HELPERS
    // -------------------------------------------------------------------------

    private function resolveUsers(): void
    {
        $admin   = User::whereHas('roles', fn ($q) => $q->where('name', 'Super Manager'))->first();
        $trainer = User::whereHas('roles', fn ($q) => $q->where('name', 'Trainers'))->first();
        $this->createdById  = $admin?->id ?? 1;
        $this->instructorId = $trainer?->id ?? $admin?->id ?? 1;
    }

    private function makeCourse(): Course
    {
        $category = CourseCategory::where('slug', 'health-management')->first();

        return Course::firstOrCreate(
            ['slug' => 'professional-certificate-health-project-management'],
            [
                'title'                      => 'Professional Certificate in Health Project Management',
                'description'                => 'This Professional Certificate equips health professionals in South Sudan with the knowledge and practical skills to plan, implement, monitor, and close health projects effectively. Participants will learn internationally recognised project management frameworks adapted to the realities of the South Sudan health sector, including resource-constrained environments, multi-stakeholder coordination, and humanitarian contexts.',
                'objectives'                 => "By the end of this course, participants will be able to:\n- Apply project management principles to health sector projects in South Sudan\n- Develop comprehensive project plans including scope, schedule, and budget\n- Manage human resources and stakeholder relationships effectively\n- Design and implement monitoring, evaluation, and learning (MEL) frameworks\n- Identify, assess, and mitigate project risks\n- Communicate project progress to diverse stakeholders\n- Close projects systematically and document lessons learned for sustainability",
                'prerequisites'              => 'Basic understanding of public health concepts. Experience working in a health facility, NGO, or government health programme is an advantage. No prior formal project management training is required.',
                'category_id'                => $category?->id,
                'instructor_id'              => $this->instructorId,
                'fee_amount'                 => 85000.00,
                'currency'                   => 'SSP',
                'duration_hours'             => 40,
                'passing_score'              => 70,
                'exam_attempts_allowed'      => 3,
                'exam_time_limit'            => 90,
                'exam_questions_per_attempt' => 20,
                'status'                     => 'published',
                'created_by'                 => $this->createdById,
                'updated_by'                 => $this->createdById,
            ]
        );
    }

    private function makeTopic(Course $course, string $title, string $description, int $order): CourseTopic
    {
        return CourseTopic::firstOrCreate(
            ['course_id' => $course->id, 'title' => $title],
            [
                'description'  => $description,
                'sort_order'   => $order,
                'is_published' => true,
            ]
        );
    }

    private function makeSub(CourseTopic $topic, string $title, string $html, int $order): void
    {
        CourseSubTopic::firstOrCreate(
            ['topic_id' => $topic->id, 'title' => $title],
            [
                'content'      => $html,
                'sort_order'   => $order,
                'is_published' => true,
            ]
        );
    }

    private function makeQuestion(Course $course, array $q, int $order): void
    {
        ExamQuestion::firstOrCreate(
            ['course_id' => $course->id, 'question_text' => $q['question']],
            [
                'option_a'               => $q['a'],
                'option_b'               => $q['b'],
                'option_c'               => $q['c'],
                'option_d'               => $q['d'],
                'correct_answer'         => $q['answer'],
                'explanation'            => $q['explanation'],
                'allow_multiple_answers' => false,
                'correct_answers_json'   => null,
                'sort_order'             => $order,
                'is_active'              => true,
            ]
        );
    }

    private function makeDownload(Course $course, string $title, string $fileName, string $mimeType, int $fileSize): void
    {
        $slug = $course->slug;
        CourseDownload::firstOrCreate(
            ['course_id' => $course->id, 'title' => $title],
            [
                'topic_id'  => null,
                'file_path' => "downloads/courses/{$slug}/{$fileName}",
                'file_name' => $fileName,
                'file_size' => $fileSize,
                'mime_type' => $mimeType,
            ]
        );
    }

    // -------------------------------------------------------------------------
    // TOPICS & SUBTOPICS
    // -------------------------------------------------------------------------

    private function seedTopics(Course $course): void
    {
        $this->seedTopic1($course);
        $this->seedTopic2($course);
        $this->seedTopic3($course);
        $this->seedTopic4($course);
        $this->seedTopic5($course);
        $this->seedTopic6($course);
        $this->seedTopic7($course);
        $this->seedTopic8($course);
    }

    // =========================================================================
    // TOPIC 1 — Introduction to Health Project Management
    // =========================================================================
    private function seedTopic1(Course $course): void
    {
        $topic = $this->makeTopic($course,
            'Introduction to Health Project Management',
            'An overview of project management concepts, frameworks, and their application in the South Sudan health sector.',
            1
        );

        $this->makeSub($topic, 'What is a Health Project?', <<<HTML
<h3>Defining Health Projects in the South Sudan Context</h3>
<p>A health project is a time-bound, goal-oriented initiative designed to achieve specific health outcomes within defined resource constraints. Unlike routine health service delivery, projects have a clear start and end date, a defined budget, and measurable objectives. In South Sudan, health projects range from immunisation campaigns and maternal health programmes to health facility construction and health information system upgrades.</p>
<p>Understanding the distinction between a project and a programme is fundamental. A <strong>programme</strong> is a collection of related projects managed in a coordinated way to obtain benefits not available from managing them individually. For example, the South Sudan Ministry of Health may run a Reproductive Health Programme comprising multiple projects: a midwifery training project, a safe motherhood awareness project, and a maternal health supply chain project.</p>
<h3>Key Characteristics of Health Projects</h3>
<ul>
  <li><strong>Temporary:</strong> Every project has a defined beginning and end.</li>
  <li><strong>Unique:</strong> Each project produces a distinct deliverable or outcome.</li>
  <li><strong>Progressive elaboration:</strong> Project details are developed incrementally as more information becomes available.</li>
  <li><strong>Resource-constrained:</strong> Projects operate within limits of time, money, and human resources.</li>
  <li><strong>Cross-functional:</strong> Health projects typically involve clinicians, administrators, community health workers, and external partners.</li>
</ul>
<p>In the South Sudan health sector, projects are often funded by international donors such as USAID, WHO, UNICEF, and the Global Fund. Understanding donor requirements, reporting cycles, and compliance obligations is therefore an essential competency for health project managers in this context.</p>
HTML, 1);

        $this->makeSub($topic, 'Project Management Frameworks and Standards', <<<HTML
<h3>Global Project Management Frameworks</h3>
<p>Several internationally recognised frameworks guide project management practice. The most widely used in the health sector include the <strong>Project Management Body of Knowledge (PMBOK)</strong> published by the Project Management Institute (PMI), the <strong>PRINCE2</strong> methodology, and the <strong>Logical Framework Approach (LFA)</strong> commonly used by UN agencies and NGOs operating in South Sudan.</p>
<h3>The Logical Framework Approach (LFA)</h3>
<p>The LFA is particularly relevant in the South Sudan health context because most donor-funded projects require a logframe. The logframe is a matrix that summarises:</p>
<ul>
  <li><strong>Goal:</strong> The broader development objective the project contributes to (e.g., reduced maternal mortality in Juba).</li>
  <li><strong>Purpose/Outcome:</strong> The specific change the project aims to achieve (e.g., increased skilled birth attendance).</li>
  <li><strong>Outputs:</strong> The tangible products or services the project will deliver (e.g., 50 midwives trained).</li>
  <li><strong>Activities:</strong> The tasks required to produce the outputs (e.g., conduct 10-day midwifery refresher training).</li>
</ul>
<h3>PMBOK Knowledge Areas</h3>
<p>The PMBOK identifies ten knowledge areas that apply to health projects: integration, scope, schedule, cost, quality, resource, communications, risk, procurement, and stakeholder management. Each area has specific processes for initiating, planning, executing, monitoring, and closing projects. Health project managers in South Sudan benefit from understanding these areas even when applying simpler frameworks, as they provide a comprehensive checklist of management considerations.</p>
<p>Selecting the right framework depends on project size, donor requirements, organisational capacity, and the complexity of the operating environment. Many South Sudan health projects use a hybrid approach combining LFA for donor reporting with PMBOK tools for day-to-day management.</p>
HTML, 2);

        $this->makeSub($topic, 'The Project Life Cycle in Health', <<<HTML
<h3>Phases of a Health Project Life Cycle</h3>
<p>Every health project passes through a series of phases collectively known as the project life cycle. Understanding these phases helps project managers anticipate what needs to be done at each stage and allocate resources accordingly. The standard health project life cycle comprises four phases:</p>
<ul>
  <li><strong>Initiation:</strong> The project is defined at a broad level. A project charter or concept note is developed, key stakeholders are identified, and initial feasibility is assessed. In South Sudan, this phase often involves community consultations and alignment with the national Health Sector Development Plan (HSDP).</li>
  <li><strong>Planning:</strong> Detailed plans are developed covering scope, schedule, budget, quality, risk, communications, and procurement. The work breakdown structure (WBS) is created, and the project team is assembled.</li>
  <li><strong>Execution:</strong> The project plan is implemented. Activities are carried out, outputs are produced, and the project manager coordinates the team and manages stakeholder expectations.</li>
  <li><strong>Monitoring and Control:</strong> Project performance is tracked against the plan. Variances are identified and corrective actions are taken. This phase runs concurrently with execution.</li>
  <li><strong>Closure:</strong> The project is formally completed. Final reports are submitted, lessons learned are documented, and resources are released.</li>
</ul>
<h3>Overlapping Phases in Practice</h3>
<p>In reality, project phases often overlap. For example, planning activities may continue into the execution phase as new information emerges. In humanitarian health responses in South Sudan — such as disease outbreak responses — the initiation and planning phases may be compressed into days rather than weeks, requiring project managers to make rapid decisions with incomplete information.</p>
<p>Understanding the life cycle helps project managers recognise which management processes are most critical at each stage and avoid common pitfalls such as beginning execution before adequate planning is complete.</p>
HTML, 3);

        $this->makeSub($topic, 'Roles and Responsibilities in Health Project Teams', <<<HTML
<h3>Key Roles in a Health Project Team</h3>
<p>Effective health project management depends on clearly defined roles and responsibilities. Ambiguity about who is responsible for what is one of the most common causes of project failure. The following roles are typically found in South Sudan health projects:</p>
<ul>
  <li><strong>Project Sponsor:</strong> The senior individual or organisation providing resources and support for the project. In donor-funded projects, the sponsor may be the donor agency or the Ministry of Health.</li>
  <li><strong>Project Manager:</strong> Responsible for day-to-day management of the project, including planning, execution, monitoring, and stakeholder communication.</li>
  <li><strong>Technical Advisor:</strong> Provides subject matter expertise (e.g., a public health specialist, epidemiologist, or clinical officer).</li>
  <li><strong>Finance Officer:</strong> Manages the project budget, financial reporting, and compliance with donor financial requirements.</li>
  <li><strong>Monitoring and Evaluation (M&E) Officer:</strong> Designs and implements the M&E framework, collects data, and reports on project indicators.</li>
  <li><strong>Community Health Workers (CHWs):</strong> Often the frontline implementers of health projects at community level in South Sudan.</li>
</ul>
<h3>The RACI Matrix</h3>
<p>A RACI matrix (Responsible, Accountable, Consulted, Informed) is a practical tool for clarifying roles. For each key project activity or deliverable, the matrix specifies who is Responsible (does the work), Accountable (owns the outcome), Consulted (provides input), and Informed (kept up to date). Using a RACI matrix reduces confusion, prevents duplication of effort, and ensures accountability — particularly important in multi-partner health projects common in South Sudan.</p>
<p>Building a cohesive project team in South Sudan requires sensitivity to cultural dynamics, language diversity, and the varying capacities of team members. Investing in team orientation and clear communication protocols at the outset pays dividends throughout the project life cycle.</p>
HTML, 4);
    }

    // =========================================================================
    // TOPIC 2 — Project Planning and Design in Health
    // =========================================================================
    private function seedTopic2(Course $course): void
    {
        $topic = $this->makeTopic($course,
            'Project Planning and Design in Health',
            'Developing comprehensive project plans including scope definition, work breakdown structures, scheduling, and resource planning for health projects.',
            2
        );

        $this->makeSub($topic, 'Scope Definition and Work Breakdown Structure', <<<HTML
<h3>Defining Project Scope</h3>
<p>Project scope defines the boundaries of the project — what is included and, equally importantly, what is excluded. A well-defined scope prevents scope creep, which is the uncontrolled expansion of project work without corresponding adjustments to time, cost, or resources. In South Sudan health projects, scope creep is a common challenge, particularly when community needs are greater than the project can address.</p>
<p>Scope definition involves two components:</p>
<ul>
  <li><strong>Product scope:</strong> The features and functions of the deliverable (e.g., a renovated health centre with specific facilities).</li>
  <li><strong>Project scope:</strong> The work required to deliver the product (e.g., procurement, construction, training, commissioning).</li>
</ul>
<h3>The Work Breakdown Structure (WBS)</h3>
<p>The WBS is a hierarchical decomposition of the total scope of work into manageable components. It organises project work into deliverables and sub-deliverables, making it easier to assign responsibilities, estimate costs, and schedule activities. A WBS for a health facility renovation project in South Sudan might include:</p>
<ul>
  <li>1.0 Project Management</li>
  <li>2.0 Site Assessment and Design</li>
  <li>3.0 Procurement</li>
  <li>4.0 Construction Works</li>
  <li>5.0 Equipment Installation</li>
  <li>6.0 Staff Training</li>
  <li>7.0 Commissioning and Handover</li>
</ul>
<p>Each element of the WBS is further broken down until the work packages are small enough to be assigned to a single team member or sub-contractor and estimated with reasonable accuracy. The WBS is the foundation for scheduling, budgeting, and risk management.</p>
HTML, 1);

        $this->makeSub($topic, 'Project Scheduling and Gantt Charts', <<<HTML
<h3>Developing a Project Schedule</h3>
<p>A project schedule translates the WBS into a time-based plan showing when each activity will be performed, how long it will take, and in what sequence. Scheduling involves three steps: defining activities, sequencing activities, and estimating durations.</p>
<p><strong>Activity sequencing</strong> identifies dependencies between activities. There are four types of dependencies:</p>
<ul>
  <li><strong>Finish-to-Start (FS):</strong> Activity B cannot start until Activity A finishes (most common).</li>
  <li><strong>Start-to-Start (SS):</strong> Activity B cannot start until Activity A starts.</li>
  <li><strong>Finish-to-Finish (FF):</strong> Activity B cannot finish until Activity A finishes.</li>
  <li><strong>Start-to-Finish (SF):</strong> Rarely used in health projects.</li>
</ul>
<h3>Gantt Charts</h3>
<p>A Gantt chart is a horizontal bar chart that displays project activities against a timeline. It is the most widely used scheduling tool in health project management because of its simplicity and visual clarity. Each bar represents an activity, with its length proportional to the activity's duration. Dependencies between activities can be shown with arrows.</p>
<p>In South Sudan, project schedules must account for contextual factors that affect activity durations, including:</p>
<ul>
  <li>Rainy season road inaccessibility (particularly in Greater Equatoria and Upper Nile regions)</li>
  <li>Public holidays and religious observances</li>
  <li>Security constraints limiting field access</li>
  <li>Procurement lead times for medical supplies and equipment</li>
  <li>Government approval processes for health interventions</li>
</ul>
<p>Building buffer time into the schedule for these factors is essential for realistic planning in the South Sudan context.</p>
HTML, 2);

        $this->makeSub($topic, 'Resource Planning and Procurement', <<<HTML
<h3>Resource Planning in Health Projects</h3>
<p>Resource planning identifies what resources — human, financial, material, and equipment — are needed to complete project activities, when they are needed, and in what quantities. Effective resource planning prevents bottlenecks and ensures that the right resources are available at the right time.</p>
<p>In South Sudan health projects, resource planning must address several unique challenges:</p>
<ul>
  <li><strong>Human resource scarcity:</strong> South Sudan has one of the lowest health worker-to-population ratios in the world. Projects must plan for recruitment lead times and potential staff turnover.</li>
  <li><strong>Supply chain constraints:</strong> Medical supplies and equipment often need to be imported, with long lead times and customs clearance delays.</li>
  <li><strong>Infrastructure limitations:</strong> Unreliable electricity, limited cold chain capacity, and poor road networks affect resource deployment.</li>
</ul>
<h3>Procurement Planning</h3>
<p>Procurement planning determines what goods and services will be purchased externally, when, and through what process. Most donor-funded health projects in South Sudan require compliance with specific procurement rules (e.g., USAID's FAR regulations, UN procurement guidelines). Key procurement documents include:</p>
<ul>
  <li><strong>Request for Quotation (RFQ):</strong> Used for low-value purchases.</li>
  <li><strong>Request for Proposal (RFP):</strong> Used for complex services requiring technical evaluation.</li>
  <li><strong>Invitation to Bid (ITB):</strong> Used for construction and large supply contracts.</li>
</ul>
<p>Maintaining a procurement tracker and ensuring all purchases are properly documented is essential for audit compliance and donor reporting in South Sudan health projects.</p>
HTML, 3);

        $this->makeSub($topic, 'Project Design and Theory of Change', <<<HTML
<h3>Theory of Change in Health Projects</h3>
<p>A Theory of Change (ToC) is a comprehensive description of how and why a desired change is expected to happen in a particular context. It maps the causal pathway from project inputs and activities through outputs and outcomes to the ultimate impact. Unlike a logframe, which is a summary matrix, a ToC provides a narrative explanation of the assumptions underlying the causal chain.</p>
<p>For example, a maternal health project in South Sudan might have the following ToC:</p>
<ul>
  <li><strong>If</strong> we train 100 community midwives (activity/output)</li>
  <li><strong>And</strong> communities trust and utilise trained midwives (assumption)</li>
  <li><strong>Then</strong> more women will deliver with a skilled birth attendant (outcome)</li>
  <li><strong>And</strong> maternal mortality will decrease (impact)</li>
</ul>
<h3>Designing for Context</h3>
<p>Effective health project design in South Sudan requires a thorough situational analysis. This includes reviewing existing health data (e.g., HMIS reports, DHIS2 data), conducting stakeholder consultations, and assessing the political, economic, social, and health system context. The <strong>PESTLE analysis</strong> (Political, Economic, Social, Technological, Legal, Environmental) is a useful tool for this purpose.</p>
<p>Projects designed without adequate contextual analysis frequently fail to achieve their objectives because they do not account for local realities such as cultural practices, community power dynamics, or the capacity of local health systems to absorb and sustain project outputs. Participatory design approaches that involve communities and local health authorities from the outset are strongly recommended for South Sudan health projects.</p>
HTML, 4);
    }

    // =========================================================================
    // TOPIC 3 — Budgeting and Financial Management for Health Projects
    // =========================================================================
    private function seedTopic3(Course $course): void
    {
        $topic = $this->makeTopic($course,
            'Budgeting and Financial Management for Health Projects',
            'Developing and managing project budgets, financial reporting, and donor compliance in the South Sudan health sector.',
            3
        );

        $this->makeSub($topic, 'Developing a Health Project Budget', <<<HTML
<h3>Budget Development Process</h3>
<p>A project budget is a detailed financial plan that estimates the costs of all project activities and resources. Developing an accurate budget is one of the most critical planning tasks because it determines whether the project is financially viable and forms the basis for financial monitoring throughout implementation.</p>
<p>The budget development process involves:</p>
<ul>
  <li><strong>Cost estimation:</strong> Estimating the cost of each activity in the WBS using techniques such as analogous estimating (based on similar past projects), parametric estimating (using unit costs), or bottom-up estimating (summing individual cost elements).</li>
  <li><strong>Budget aggregation:</strong> Rolling up activity-level cost estimates to produce a total project budget.</li>
  <li><strong>Contingency reserve:</strong> Adding a contingency allowance (typically 5–15%) to cover identified risks.</li>
  <li><strong>Management reserve:</strong> An additional reserve for unknown risks, held by the project sponsor.</li>
</ul>
<h3>Budget Line Items in South Sudan Health Projects</h3>
<p>Typical budget categories for health projects in South Sudan include:</p>
<ul>
  <li>Personnel (salaries, benefits, consultancy fees)</li>
  <li>Travel and transport (field visits, fuel, vehicle hire)</li>
  <li>Training and workshops (venue, materials, per diems)</li>
  <li>Medical supplies and equipment</li>
  <li>Construction and rehabilitation</li>
  <li>Communications (phone, internet)</li>
  <li>Indirect costs / overhead (typically 7–15% of direct costs for NGOs)</li>
</ul>
<p>Per diem rates in South Sudan vary by location and donor. Projects must use approved per diem scales and document all payments to avoid audit findings. The UN DSA (Daily Subsistence Allowance) rates are commonly used as a reference.</p>
HTML, 1);

        $this->makeSub($topic, 'Budget Monitoring and Expenditure Tracking', <<<HTML
<h3>Budget vs. Actual Analysis</h3>
<p>Once a project is underway, the project manager must regularly compare actual expenditure against the approved budget. This budget vs. actual analysis identifies variances — situations where spending is significantly above or below the budget line. Both over-spending and under-spending are problematic: over-spending may indicate poor cost control, while under-spending may signal implementation delays.</p>
<p>A <strong>burn rate</strong> analysis calculates how quickly the project is spending its budget relative to the implementation timeline. If a project is 50% through its timeline but has only spent 20% of its budget, this is a warning sign of implementation delays that may jeopardise project completion.</p>
<h3>Financial Reporting Requirements</h3>
<p>Donor-funded health projects in South Sudan typically require monthly or quarterly financial reports. These reports must reconcile expenditure against budget lines, explain significant variances, and provide a forecast of future spending. Common financial reporting tools include:</p>
<ul>
  <li><strong>Budget vs. Actual (BvA) report:</strong> Compares planned and actual expenditure by budget line.</li>
  <li><strong>Cash flow forecast:</strong> Projects future cash needs to ensure adequate liquidity.</li>
  <li><strong>Expenditure verification report:</strong> An independent audit of project expenditure, often required by major donors.</li>
</ul>
<p>Maintaining accurate financial records is not only a donor requirement but also a legal obligation under South Sudan's NGO Act and financial regulations. All financial transactions must be supported by original receipts, payment vouchers, and bank statements.</p>
HTML, 2);

        $this->makeSub($topic, 'Donor Compliance and Financial Controls', <<<HTML
<h3>Understanding Donor Financial Requirements</h3>
<p>Each donor has specific financial management requirements that health project managers must understand and comply with. Failure to comply can result in disallowed costs, suspension of funding, or termination of the project. Key compliance areas include:</p>
<ul>
  <li><strong>Allowable costs:</strong> Donors specify which types of costs can be charged to the project. For example, USAID prohibits charging lobbying activities to project budgets.</li>
  <li><strong>Prior approval requirements:</strong> Budget reallocations above a certain threshold (e.g., 10% of a budget line) typically require prior written approval from the donor.</li>
  <li><strong>Procurement rules:</strong> Donors require competitive procurement processes for purchases above specified thresholds.</li>
  <li><strong>Audit requirements:</strong> Most major donors require annual independent audits of project finances.</li>
</ul>
<h3>Internal Financial Controls</h3>
<p>Strong internal financial controls protect project assets and prevent fraud and misappropriation — a significant risk in fragile contexts like South Sudan. Essential controls include:</p>
<ul>
  <li><strong>Segregation of duties:</strong> The person who authorises a payment should not be the same person who makes the payment or records it in the accounts.</li>
  <li><strong>Dual authorisation:</strong> Payments above a threshold require two authorised signatories.</li>
  <li><strong>Regular bank reconciliations:</strong> Bank statements are reconciled with project accounts monthly.</li>
  <li><strong>Asset register:</strong> All project assets are recorded, tagged, and periodically verified.</li>
</ul>
<p>Building a culture of financial accountability within the project team is as important as having formal control systems. Regular financial training for project staff and clear consequences for financial misconduct are essential components of good financial governance.</p>
HTML, 3);

        $this->makeSub($topic, 'Cost-Effectiveness Analysis in Health Projects', <<<HTML
<h3>Why Cost-Effectiveness Matters</h3>
<p>In resource-constrained environments like South Sudan, health project managers must demonstrate that their projects represent good value for money. Cost-effectiveness analysis (CEA) compares the costs of different interventions to achieve the same health outcome, helping decision-makers allocate scarce resources to the most efficient interventions.</p>
<p>The most common metric in health CEA is the <strong>cost per DALY averted</strong> (Disability-Adjusted Life Year). A DALY represents one year of healthy life lost due to illness, disability, or premature death. Interventions that avert DALYs at lower cost are considered more cost-effective.</p>
<h3>Applying CEA in South Sudan</h3>
<p>When designing health projects in South Sudan, project managers should consider:</p>
<ul>
  <li>The cost per beneficiary reached by the intervention</li>
  <li>The cost per unit of output (e.g., cost per child immunised, cost per woman receiving antenatal care)</li>
  <li>Comparison with alternative interventions addressing the same health problem</li>
  <li>The sustainability of the intervention after project funding ends</li>
</ul>
<p>Cost-effectiveness data should be incorporated into project proposals and donor reports to demonstrate accountability and justify resource allocation decisions. The Disease Control Priorities (DCP3) project provides cost-effectiveness data for many health interventions relevant to South Sudan, including child health, maternal health, and infectious disease control.</p>
<p>Understanding cost-effectiveness also helps project managers make difficult trade-off decisions during implementation when budgets are cut or costs escalate unexpectedly.</p>
HTML, 4);
    }

    // =========================================================================
    // TOPIC 4 — Human Resources Management in Health Projects
    // =========================================================================
    private function seedTopic4(Course $course): void
    {
        $topic = $this->makeTopic($course,
            'Human Resources Management in Health Projects',
            'Recruiting, managing, motivating, and developing project teams in the South Sudan health sector context.',
            4
        );

        $this->makeSub($topic, 'Recruitment and Staffing for Health Projects', <<<HTML
<h3>Human Resource Planning</h3>
<p>Human resource planning for health projects involves identifying the skills and competencies required, determining the number of staff needed, and planning how and when to recruit them. In South Sudan, HR planning must account for the severe shortage of qualified health professionals, the geographic dispersion of project sites, and the security constraints that affect staff deployment.</p>
<p>A <strong>staffing plan</strong> documents the roles required, the qualifications and experience needed for each role, the recruitment timeline, and the employment terms (full-time, part-time, consultancy). The staffing plan should be developed during the project planning phase and updated as the project evolves.</p>
<h3>Recruitment Challenges in South Sudan</h3>
<p>Recruiting qualified staff for health projects in South Sudan presents unique challenges:</p>
<ul>
  <li><strong>Limited talent pool:</strong> South Sudan has very few trained health professionals relative to its population. Competition for qualified staff among NGOs, UN agencies, and government is intense.</li>
  <li><strong>Geographic barriers:</strong> Many project sites are in remote areas with poor infrastructure, making it difficult to attract and retain staff.</li>
  <li><strong>Security risks:</strong> Staff may be reluctant to work in conflict-affected areas without adequate security measures and hardship allowances.</li>
  <li><strong>Language diversity:</strong> South Sudan has over 60 languages. Projects may need staff who speak local languages in addition to English or Arabic.</li>
</ul>
<p>Effective recruitment strategies include partnering with local universities and health training institutions, offering competitive remuneration packages, providing security briefings and support, and investing in staff development to build loyalty and retention.</p>
HTML, 1);

        $this->makeSub($topic, 'Performance Management and Staff Development', <<<HTML
<h3>Setting Performance Expectations</h3>
<p>Clear performance expectations are the foundation of effective performance management. At the start of a project, each team member should have a job description that clearly defines their responsibilities, key performance indicators (KPIs), and reporting relationships. Regular performance reviews — typically quarterly — provide an opportunity to assess progress against KPIs, identify challenges, and agree on development plans.</p>
<h3>Capacity Building in Health Projects</h3>
<p>Many health projects in South Sudan include a capacity building component aimed at strengthening the skills of local health workers and government staff. Effective capacity building goes beyond one-off training events to include:</p>
<ul>
  <li><strong>On-the-job training and mentoring:</strong> Experienced staff work alongside less experienced colleagues to transfer skills in real work settings.</li>
  <li><strong>Coaching:</strong> A coach works with an individual to help them develop specific competencies over time.</li>
  <li><strong>Structured learning programmes:</strong> Formal training courses, workshops, and e-learning modules.</li>
  <li><strong>Communities of practice:</strong> Groups of practitioners who share knowledge and learn from each other's experiences.</li>
</ul>
<p>Capacity building investments should be documented and their outcomes measured. A training needs assessment at the start of the project identifies priority learning needs, and post-training evaluations assess whether learning has been transferred to the workplace.</p>
HTML, 2);

        $this->makeSub($topic, 'Team Motivation and Conflict Resolution', <<<HTML
<h3>Motivating Health Project Teams</h3>
<p>Motivated teams are more productive, more creative, and more resilient in the face of challenges. Understanding what motivates team members is therefore a critical leadership skill for health project managers. Motivation theories provide useful frameworks:</p>
<ul>
  <li><strong>Maslow's Hierarchy of Needs:</strong> People are motivated by progressively higher-order needs, from basic physiological needs (food, shelter) to self-actualisation. In South Sudan, ensuring that basic needs — including safety and security — are met is a prerequisite for higher-level motivation.</li>
  <li><strong>Herzberg's Two-Factor Theory:</strong> Hygiene factors (salary, working conditions) prevent dissatisfaction but do not motivate. Motivators (recognition, achievement, growth) drive positive engagement.</li>
  <li><strong>Self-Determination Theory:</strong> People are intrinsically motivated when they experience autonomy, competence, and relatedness.</li>
</ul>
<h3>Managing Conflict in Project Teams</h3>
<p>Conflict is inevitable in project teams, particularly in high-pressure environments. Unresolved conflict reduces team performance and can derail projects. Common sources of conflict in South Sudan health projects include resource allocation disputes, unclear roles, cultural misunderstandings, and disagreements about technical approaches.</p>
<p>Effective conflict resolution strategies include:</p>
<ul>
  <li><strong>Confronting/Problem-solving:</strong> Addressing the conflict directly and working collaboratively to find a mutually acceptable solution. This is the most effective approach for most conflicts.</li>
  <li><strong>Compromising:</strong> Both parties give up something to reach an agreement. Useful when a quick resolution is needed.</li>
  <li><strong>Smoothing:</strong> Emphasising areas of agreement and downplaying differences. Useful for minor conflicts.</li>
  <li><strong>Forcing:</strong> Using authority to impose a solution. Should be used sparingly as it damages relationships.</li>
</ul>
HTML, 3);

        $this->makeSub($topic, 'HR Policies, Labour Law, and Staff Welfare', <<<HTML
<h3>South Sudan Labour Law Compliance</h3>
<p>Health project managers must ensure that their HR practices comply with South Sudan's Labour Act and any applicable donor HR policies. Key legal requirements include:</p>
<ul>
  <li><strong>Employment contracts:</strong> All staff must have written employment contracts specifying terms and conditions of employment.</li>
  <li><strong>Minimum wage:</strong> Projects must pay at least the statutory minimum wage, though in practice most NGO and UN projects pay significantly above this level.</li>
  <li><strong>Leave entitlements:</strong> Staff are entitled to annual leave, sick leave, and maternity/paternity leave as specified in the Labour Act.</li>
  <li><strong>Termination procedures:</strong> Dismissal must follow due process, including written warnings and the right to respond to allegations.</li>
</ul>
<h3>Staff Welfare and Duty of Care</h3>
<p>Working in South Sudan's health sector — particularly in conflict-affected areas — exposes staff to significant physical and psychological risks. Project managers have a duty of care to protect staff wellbeing. This includes:</p>
<ul>
  <li>Providing adequate security briefings and personal protective equipment</li>
  <li>Ensuring access to medical care and evacuation procedures</li>
  <li>Providing psychosocial support for staff experiencing trauma or burnout</li>
  <li>Implementing clear policies on sexual harassment and gender-based violence</li>
  <li>Ensuring equitable treatment of national and international staff</li>
</ul>
<p>Staff welfare is not only an ethical obligation but also a practical necessity: high staff turnover due to poor welfare conditions is one of the most significant threats to project continuity and effectiveness in South Sudan.</p>
HTML, 4);
    }

    // =========================================================================
    // TOPIC 5 — Monitoring, Evaluation and Learning (MEL)
    // =========================================================================
    private function seedTopic5(Course $course): void
    {
        $topic = $this->makeTopic($course,
            'Monitoring, Evaluation and Learning (MEL)',
            'Designing and implementing MEL frameworks to track project performance, measure outcomes, and generate learning for health projects in South Sudan.',
            5
        );

        $this->makeSub($topic, 'Designing a MEL Framework', <<<HTML
<h3>Components of a MEL Framework</h3>
<p>A Monitoring, Evaluation and Learning (MEL) framework is a systematic plan for tracking project performance, measuring outcomes, and generating evidence to inform decision-making. It is one of the most important planning documents for any health project. A comprehensive MEL framework includes:</p>
<ul>
  <li><strong>Results framework:</strong> A visual representation of the causal chain from inputs to impact, showing how project activities contribute to desired outcomes.</li>
  <li><strong>Indicator matrix:</strong> A table listing all project indicators with their definitions, baselines, targets, data sources, collection frequency, and responsible parties.</li>
  <li><strong>Data collection plan:</strong> Specifies how, when, and by whom data will be collected for each indicator.</li>
  <li><strong>Evaluation plan:</strong> Outlines the types of evaluations to be conducted (baseline, midterm, endline) and their methodologies.</li>
  <li><strong>Learning agenda:</strong> Identifies key learning questions the project will seek to answer through its MEL activities.</li>
</ul>
<h3>SMART Indicators</h3>
<p>Good project indicators are SMART: Specific, Measurable, Achievable, Relevant, and Time-bound. For example, a SMART indicator for a maternal health project in South Sudan might be: "Percentage of pregnant women in target counties who attend at least four antenatal care visits, measured quarterly, with a baseline of 35% and a target of 60% by project end."</p>
<p>Indicators should be disaggregated by sex, age, location, and other relevant characteristics to enable equity analysis and ensure that project benefits reach the most vulnerable populations.</p>
HTML, 1);

        $this->makeSub($topic, 'Data Collection Methods and Tools', <<<HTML
<h3>Quantitative Data Collection</h3>
<p>Quantitative data collection methods generate numerical data that can be statistically analysed. Common methods used in South Sudan health projects include:</p>
<ul>
  <li><strong>Health facility registers and HMIS data:</strong> Routine health information collected at facility level and aggregated through the Health Management Information System (HMIS) / DHIS2.</li>
  <li><strong>Household surveys:</strong> Structured questionnaires administered to a representative sample of households to measure population-level health indicators.</li>
  <li><strong>Service delivery data:</strong> Records of services provided (e.g., number of children immunised, number of women receiving antenatal care).</li>
  <li><strong>Tally sheets and registers:</strong> Simple paper-based tools for recording service delivery data at facility level.</li>
</ul>
<h3>Qualitative Data Collection</h3>
<p>Qualitative methods generate rich, contextual data that helps explain why and how project outcomes are achieved. Common qualitative methods include:</p>
<ul>
  <li><strong>Key informant interviews (KIIs):</strong> In-depth interviews with individuals who have specialised knowledge or experience relevant to the project.</li>
  <li><strong>Focus group discussions (FGDs):</strong> Facilitated discussions with groups of 6–10 participants to explore perceptions, attitudes, and experiences.</li>
  <li><strong>Observation:</strong> Direct observation of health service delivery or community practices.</li>
  <li><strong>Most Significant Change (MSC):</strong> A participatory technique for collecting stories of significant change from project beneficiaries.</li>
</ul>
<p>In South Sudan, data collection faces practical challenges including low literacy rates, language barriers, security constraints, and limited connectivity. Data collection tools should be adapted to local contexts, and data collectors should receive thorough training and supervision.</p>
HTML, 2);

        $this->makeSub($topic, 'Data Analysis, Reporting, and Use', <<<HTML
<h3>Analysing Project Data</h3>
<p>Data analysis transforms raw data into meaningful information that can inform project decisions. For quantitative data, analysis typically involves calculating indicator values, comparing them against targets and baselines, and identifying trends over time. For qualitative data, analysis involves coding, categorising, and interpreting themes and patterns.</p>
<p>Common data analysis tools used in South Sudan health projects include:</p>
<ul>
  <li><strong>Microsoft Excel:</strong> Widely used for basic quantitative analysis, data visualisation, and dashboard creation.</li>
  <li><strong>DHIS2:</strong> The national health information system used by the South Sudan Ministry of Health for routine health data.</li>
  <li><strong>KoBoToolbox / ODK:</strong> Mobile data collection platforms that facilitate data entry, storage, and basic analysis.</li>
  <li><strong>SPSS / Stata / R:</strong> Statistical software used for more complex quantitative analysis in research and evaluation studies.</li>
</ul>
<h3>Reporting and Data Use</h3>
<p>Data is only valuable if it is used to improve project performance. A culture of data use requires:</p>
<ul>
  <li>Regular data review meetings where project staff discuss performance data and agree on corrective actions</li>
  <li>Clear feedback mechanisms to share data with community members and local health authorities</li>
  <li>Timely and accurate donor reports that present data honestly, including challenges and lessons learned</li>
  <li>Documentation of how data has influenced project decisions</li>
</ul>
<p>Adaptive management — adjusting project activities based on evidence from MEL — is increasingly recognised as a best practice in health project management, particularly in dynamic and unpredictable environments like South Sudan.</p>
HTML, 3);

        $this->makeSub($topic, 'Evaluation Types and Learning Systems', <<<HTML
<h3>Types of Project Evaluations</h3>
<p>Evaluations provide an independent assessment of project performance, relevance, effectiveness, efficiency, impact, and sustainability. The main types of evaluations used in South Sudan health projects are:</p>
<ul>
  <li><strong>Baseline assessment:</strong> Conducted at the start of the project to establish the pre-intervention status of key indicators. Provides the reference point against which project outcomes will be measured.</li>
  <li><strong>Midterm evaluation:</strong> Conducted at the midpoint of the project to assess progress, identify challenges, and recommend adjustments. Particularly important for multi-year projects.</li>
  <li><strong>Endline/final evaluation:</strong> Conducted at or near project completion to assess the extent to which project objectives were achieved and document lessons learned.</li>
  <li><strong>Real-time evaluation:</strong> Rapid assessments conducted during humanitarian responses to provide timely feedback for operational decision-making.</li>
</ul>
<h3>Building a Learning System</h3>
<p>A learning system goes beyond evaluation to create ongoing mechanisms for generating, sharing, and applying knowledge. Components of a project learning system include:</p>
<ul>
  <li>Regular after-action reviews following key project events</li>
  <li>Documented case studies and success stories</li>
  <li>Peer learning exchanges with other projects and organisations</li>
  <li>A knowledge management platform for storing and sharing project documents and lessons</li>
  <li>Contribution to sector-wide learning through publications, conferences, and communities of practice</li>
</ul>
<p>In South Sudan, where institutional memory is often lost due to staff turnover and organisational instability, systematic documentation and knowledge management are particularly important for ensuring that lessons from one project inform the design of future interventions.</p>
HTML, 4);
    }

    // =========================================================================
    // TOPIC 6 — Risk Management and Mitigation
    // =========================================================================
    private function seedTopic6(Course $course): void
    {
        $topic = $this->makeTopic($course,
            'Risk Management and Mitigation',
            'Identifying, assessing, and mitigating risks in health projects operating in complex and fragile environments.',
            6
        );

        $this->makeSub($topic, 'Risk Identification and Assessment', <<<HTML
<h3>Understanding Project Risk</h3>
<p>A project risk is an uncertain event or condition that, if it occurs, has a positive or negative effect on project objectives. Risk management is the systematic process of identifying, analysing, and responding to project risks. In South Sudan, health projects face an exceptionally wide range of risks due to the country's fragile political situation, weak health system, and challenging operating environment.</p>
<h3>Risk Identification Techniques</h3>
<p>Common risk identification techniques include:</p>
<ul>
  <li><strong>Brainstorming:</strong> The project team generates a comprehensive list of potential risks in a facilitated session.</li>
  <li><strong>SWOT analysis:</strong> Identifies internal strengths and weaknesses and external opportunities and threats.</li>
  <li><strong>Checklist analysis:</strong> Uses a standardised list of risk categories to prompt identification of risks that might otherwise be overlooked.</li>
  <li><strong>Expert interviews:</strong> Consults experienced practitioners who have worked in similar contexts.</li>
</ul>
<h3>Risk Assessment Matrix</h3>
<p>Once risks are identified, they are assessed on two dimensions: <strong>probability</strong> (likelihood of occurrence) and <strong>impact</strong> (severity of effect on project objectives). A risk matrix plots risks on a grid with probability on one axis and impact on the other, producing a risk score that prioritises which risks require the most attention. High-probability, high-impact risks (e.g., security incidents in conflict-affected areas of South Sudan) require immediate mitigation planning.</p>
<p>Common risk categories for South Sudan health projects include: security risks, political risks, financial risks (currency devaluation, funding cuts), operational risks (supply chain disruptions, staff turnover), reputational risks, and natural disaster risks (flooding, drought).</p>
HTML, 1);

        $this->makeSub($topic, 'Risk Response Strategies', <<<HTML
<h3>Four Risk Response Strategies</h3>
<p>For each identified risk, the project team must decide on an appropriate response strategy. There are four main strategies for negative risks (threats):</p>
<ul>
  <li><strong>Avoid:</strong> Eliminate the risk by changing the project plan. For example, relocating a project activity from a high-security-risk area to a safer location.</li>
  <li><strong>Transfer:</strong> Shift the financial impact of the risk to a third party, typically through insurance or contractual arrangements.</li>
  <li><strong>Mitigate:</strong> Reduce the probability or impact of the risk. For example, pre-positioning medical supplies to reduce the impact of supply chain disruptions.</li>
  <li><strong>Accept:</strong> Acknowledge the risk and decide not to take any proactive action, either because the risk is low priority or because no cost-effective response is available.</li>
</ul>
<h3>Contingency Planning</h3>
<p>Contingency plans are pre-agreed responses that will be activated if a specific risk materialises. For example, a health project in South Sudan might have a contingency plan for evacuating staff if security deteriorates, including pre-identified evacuation routes, assembly points, and communication protocols. Contingency plans should be documented, communicated to all relevant staff, and regularly reviewed and updated.</p>
<p>Risk management is not a one-time activity but an ongoing process throughout the project life cycle. The risk register should be reviewed at regular intervals (e.g., monthly) and updated as new risks emerge and existing risks change in probability or impact.</p>
HTML, 2);

        $this->makeSub($topic, 'Security Risk Management in South Sudan', <<<HTML
<h3>The Security Context in South Sudan</h3>
<p>South Sudan has experienced significant conflict and instability since independence in 2011. Health project managers must understand the security context in their areas of operation and implement appropriate security risk management measures. Security risks include armed conflict, inter-communal violence, crime, and road accidents.</p>
<h3>Security Risk Management Framework</h3>
<p>A security risk management framework for health projects in South Sudan should include:</p>
<ul>
  <li><strong>Security assessment:</strong> Regular assessment of the security situation in project areas, drawing on information from UNDSS, OCHA, and local sources.</li>
  <li><strong>Security protocols:</strong> Clear rules and procedures for staff movement, communication, and behaviour in different security scenarios.</li>
  <li><strong>Security training:</strong> All staff should receive security awareness training before deployment to field locations.</li>
  <li><strong>Communication systems:</strong> Reliable communication equipment (HF radio, satellite phone) for areas with poor mobile network coverage.</li>
  <li><strong>Incident reporting:</strong> A clear system for reporting and documenting security incidents.</li>
  <li><strong>Evacuation plan:</strong> A documented plan for evacuating staff in the event of a serious security incident.</li>
</ul>
<p>Health projects should coordinate with UNDSS (UN Department of Safety and Security) and other NGO security networks such as INSO (International NGO Safety Organisation) to access security information and support. Acceptance-based security strategies — building trust and acceptance with local communities and authorities — are often more effective than protection-based approaches in South Sudan.</p>
HTML, 3);

        $this->makeSub($topic, 'Financial and Operational Risk Controls', <<<HTML
<h3>Financial Risk Management</h3>
<p>Financial risks are among the most significant threats to health project success in South Sudan. Key financial risks include:</p>
<ul>
  <li><strong>Currency risk:</strong> The South Sudanese Pound (SSP) has experienced significant devaluation. Projects budgeted in USD or other hard currencies may face budget shortfalls if the exchange rate moves unfavourably.</li>
  <li><strong>Funding cuts:</strong> Donor funding can be reduced or suspended due to political decisions, budget constraints, or compliance failures.</li>
  <li><strong>Fraud and misappropriation:</strong> Weak financial controls and high cash usage increase the risk of fraud.</li>
  <li><strong>Inflation:</strong> South Sudan has experienced high inflation, which can erode the purchasing power of project budgets.</li>
</ul>
<h3>Operational Risk Controls</h3>
<p>Operational risks relate to the day-to-day management of project activities. Controls include:</p>
<ul>
  <li>Maintaining buffer stocks of critical medical supplies to mitigate supply chain disruptions</li>
  <li>Cross-training staff to cover key roles in the event of staff absence or turnover</li>
  <li>Maintaining backup data storage and IT systems</li>
  <li>Establishing clear escalation procedures for operational problems</li>
  <li>Regular vehicle maintenance and driver safety training to reduce road accident risk</li>
</ul>
<p>A comprehensive risk register that documents all identified risks, their probability and impact scores, assigned risk owners, and agreed response actions is an essential project management tool. The risk register should be a living document, reviewed and updated throughout the project life cycle.</p>
HTML, 4);
    }

    // =========================================================================
    // TOPIC 7 — Stakeholder Engagement and Communication
    // =========================================================================
    private function seedTopic7(Course $course): void
    {
        $topic = $this->makeTopic($course,
            'Stakeholder Engagement and Communication',
            'Identifying, analysing, and engaging project stakeholders and developing effective communication strategies for health projects.',
            7
        );

        $this->makeSub($topic, 'Stakeholder Identification and Analysis', <<<HTML
<h3>Who Are Project Stakeholders?</h3>
<p>Project stakeholders are individuals, groups, or organisations that may affect, be affected by, or perceive themselves to be affected by a project. Effective stakeholder management is critical for health project success because health projects operate in complex social and political environments with multiple competing interests.</p>
<p>In South Sudan health projects, key stakeholder groups typically include:</p>
<ul>
  <li><strong>Government:</strong> Ministry of Health (national and state levels), county health departments, local government authorities</li>
  <li><strong>Donors:</strong> Bilateral donors (USAID, DFID/FCDO, EU), multilateral agencies (WHO, UNICEF, UNFPA, Global Fund)</li>
  <li><strong>Implementing partners:</strong> NGOs, community-based organisations, private sector providers</li>
  <li><strong>Beneficiaries:</strong> Communities, patients, health workers</li>
  <li><strong>Traditional and religious leaders:</strong> Influential figures who can facilitate or obstruct project implementation</li>
  <li><strong>Media:</strong> Local and international media that can shape public perception of the project</li>
</ul>
<h3>Stakeholder Analysis Tools</h3>
<p>A <strong>stakeholder matrix</strong> maps stakeholders on two dimensions: their level of interest in the project and their level of influence over project outcomes. This produces four quadrants: high interest/high influence (key players to engage closely), high interest/low influence (keep informed), low interest/high influence (keep satisfied), and low interest/low influence (monitor). This analysis guides the allocation of stakeholder engagement resources.</p>
HTML, 1);

        $this->makeSub($topic, 'Developing a Communication Plan', <<<HTML
<h3>The Project Communication Plan</h3>
<p>A communication plan documents how project information will be shared with stakeholders. It specifies what information will be communicated, to whom, by whom, through what channel, and how frequently. A well-designed communication plan ensures that all stakeholders receive the information they need, in a format they can understand, at the right time.</p>
<p>Key elements of a health project communication plan include:</p>
<ul>
  <li><strong>Stakeholder communication needs:</strong> Different stakeholders need different types of information. Donors need financial and progress reports; communities need information about project activities and how to access services; government partners need coordination updates.</li>
  <li><strong>Communication channels:</strong> Options include formal reports, meetings, workshops, community radio, SMS, social media, and community notice boards. Channel selection should consider stakeholder literacy levels, language preferences, and access to technology.</li>
  <li><strong>Communication frequency:</strong> Donor reports may be monthly or quarterly; community updates may be more frequent during active implementation phases.</li>
  <li><strong>Feedback mechanisms:</strong> Two-way communication channels that allow stakeholders to provide feedback, raise concerns, and ask questions.</li>
</ul>
<p>In South Sudan, community radio is a particularly effective communication channel for reaching rural populations with low literacy rates. Projects should consider partnering with local radio stations to broadcast health messages and project updates in local languages.</p>
HTML, 2);

        $this->makeSub($topic, 'Community Engagement and Participation', <<<HTML
<h3>Why Community Engagement Matters</h3>
<p>Community engagement is not just a best practice — it is a prerequisite for health project success in South Sudan. Projects that are designed and implemented without meaningful community participation frequently fail to achieve their objectives because they do not address community priorities, do not gain community trust, or produce outputs that communities do not use or value.</p>
<h3>Principles of Effective Community Engagement</h3>
<ul>
  <li><strong>Respect:</strong> Treat community members as partners, not passive recipients of services.</li>
  <li><strong>Inclusion:</strong> Ensure that marginalised groups — women, youth, people with disabilities, ethnic minorities — are included in engagement processes.</li>
  <li><strong>Transparency:</strong> Be honest about what the project can and cannot do, and communicate openly about project decisions.</li>
  <li><strong>Accountability:</strong> Establish mechanisms for communities to hold the project accountable for its commitments.</li>
  <li><strong>Cultural sensitivity:</strong> Understand and respect local cultural norms, values, and practices.</li>
</ul>
<h3>Community Engagement Methods</h3>
<p>Practical community engagement methods for South Sudan health projects include:</p>
<ul>
  <li>Community health committees and village health teams</li>
  <li>Community dialogues and town hall meetings</li>
  <li>Participatory rural appraisal (PRA) techniques</li>
  <li>Community scorecards for assessing health service quality</li>
  <li>Feedback boxes and community hotlines</li>
</ul>
<p>Engaging traditional and religious leaders as project champions can significantly enhance community acceptance and participation, particularly for sensitive health topics such as family planning, HIV/AIDS, and mental health.</p>
HTML, 3);

        $this->makeSub($topic, 'Donor Reporting and Government Coordination', <<<HTML
<h3>Donor Reporting Requirements</h3>
<p>Effective communication with donors is essential for maintaining funding and building long-term partnerships. Donor reports typically include:</p>
<ul>
  <li><strong>Narrative progress report:</strong> Describes activities implemented, outputs achieved, challenges encountered, and lessons learned during the reporting period.</li>
  <li><strong>Financial report:</strong> Presents expenditure against budget, explains variances, and provides a forecast of future spending.</li>
  <li><strong>Indicator performance table:</strong> Shows progress against all project indicators, with data disaggregated as required.</li>
  <li><strong>Success stories and case studies:</strong> Illustrative examples of project impact that bring the data to life.</li>
</ul>
<h3>Government Coordination in South Sudan</h3>
<p>Health projects in South Sudan must coordinate closely with the Ministry of Health and state/county health departments to ensure alignment with national health priorities and avoid duplication of effort. Key coordination mechanisms include:</p>
<ul>
  <li><strong>Health cluster meetings:</strong> Regular coordination meetings for health actors in humanitarian settings, co-chaired by WHO and the Ministry of Health.</li>
  <li><strong>Technical working groups:</strong> Thematic groups (e.g., maternal health TWG, nutrition TWG) that coordinate technical approaches and share information.</li>
  <li><strong>Joint planning and review meetings:</strong> Periodic meetings between project staff and government counterparts to review progress and plan upcoming activities.</li>
  <li><strong>Memoranda of Understanding (MoUs):</strong> Formal agreements between the project and government that define roles, responsibilities, and resource contributions.</li>
</ul>
<p>Building strong relationships with government counterparts is a long-term investment that pays dividends in terms of project sustainability and government ownership of project outcomes.</p>
HTML, 4);
    }

    // =========================================================================
    // TOPIC 8 — Project Closure and Sustainability
    // =========================================================================
    private function seedTopic8(Course $course): void
    {
        $topic = $this->makeTopic($course,
            'Project Closure and Sustainability',
            'Systematically closing health projects, documenting lessons learned, and planning for sustainability of project outcomes.',
            8
        );

        $this->makeSub($topic, 'Project Closure Processes and Documentation', <<<HTML
<h3>Why Proper Project Closure Matters</h3>
<p>Project closure is the final phase of the project life cycle, yet it is often neglected in the rush to complete activities and submit final reports. Proper closure ensures that all project deliverables have been completed and accepted, all contractual obligations have been fulfilled, all financial accounts have been settled, and lessons learned have been documented for future projects.</p>
<h3>Project Closure Checklist</h3>
<p>A comprehensive project closure checklist for South Sudan health projects should include:</p>
<ul>
  <li><strong>Technical closure:</strong> All project outputs have been delivered and accepted by the client/beneficiary. Final technical reports have been submitted to the donor.</li>
  <li><strong>Financial closure:</strong> All expenditures have been recorded and reconciled. Final financial reports and audit reports have been submitted. Any unspent funds have been returned to the donor.</li>
  <li><strong>Administrative closure:</strong> All contracts with suppliers and consultants have been closed. Staff employment contracts have been terminated in accordance with labour law. Project assets have been transferred, disposed of, or returned as per donor requirements.</li>
  <li><strong>Knowledge management:</strong> Lessons learned have been documented and shared. Project documents have been archived in an accessible format.</li>
  <li><strong>Stakeholder communication:</strong> All stakeholders have been informed of project closure. A final stakeholder meeting or dissemination event has been held.</li>
</ul>
HTML, 1);

        $this->makeSub($topic, 'Lessons Learned and After-Action Reviews', <<<HTML
<h3>The Importance of Lessons Learned</h3>
<p>Documenting lessons learned is one of the most valuable activities in project closure. Lessons learned capture what worked well, what did not work, and what should be done differently in future projects. In South Sudan, where many health challenges are persistent and recurring, lessons from one project can significantly improve the design and implementation of subsequent interventions.</p>
<h3>Conducting an After-Action Review (AAR)</h3>
<p>An After-Action Review is a structured discussion of a project or project phase that answers four questions:</p>
<ul>
  <li><strong>What was supposed to happen?</strong> (planned objectives and activities)</li>
  <li><strong>What actually happened?</strong> (actual outcomes and activities)</li>
  <li><strong>Why were there differences?</strong> (analysis of variances)</li>
  <li><strong>What can we learn from this?</strong> (lessons for future projects)</li>
</ul>
<p>AARs should be conducted in a blame-free environment that encourages honest reflection. Participants should include project staff at all levels, as frontline workers often have the most valuable insights about what worked and what did not at the community level.</p>
<h3>Documenting and Sharing Lessons</h3>
<p>Lessons learned should be documented in a structured format and shared widely — with the donor, with government partners, with other NGOs working in the same sector, and with the broader health community through publications and conferences. The South Sudan Health Cluster and relevant technical working groups are important platforms for sharing lessons from health projects.</p>
HTML, 2);

        $this->makeSub($topic, 'Sustainability Planning for Health Projects', <<<HTML
<h3>What is Project Sustainability?</h3>
<p>Project sustainability refers to the continuation of project benefits after external funding ends. Sustainability is one of the most challenging aspects of health project management in South Sudan, where many health services are heavily dependent on external donor funding and where government capacity to absorb and maintain project outputs is limited.</p>
<h3>Dimensions of Sustainability</h3>
<p>Sustainability has multiple dimensions that must be addressed in project design and implementation:</p>
<ul>
  <li><strong>Financial sustainability:</strong> Are there domestic funding sources (government budget, community contributions, user fees) that can sustain project activities after donor funding ends?</li>
  <li><strong>Institutional sustainability:</strong> Are local institutions (government health departments, community organisations) capable of continuing project activities?</li>
  <li><strong>Human resource sustainability:</strong> Are there sufficient trained health workers to maintain project services?</li>
  <li><strong>Technical sustainability:</strong> Are the technologies and approaches used by the project appropriate for the local context and maintainable with local resources?</li>
  <li><strong>Political sustainability:</strong> Is there sufficient political will and government commitment to continue supporting project outcomes?</li>
</ul>
<h3>Sustainability Strategies</h3>
<p>Practical sustainability strategies for South Sudan health projects include: integrating project activities into government health plans and budgets from the outset; building the capacity of local institutions to manage and finance health services; using low-cost, locally appropriate technologies; advocating for increased domestic health financing; and designing exit strategies that gradually transfer responsibility to local actors.</p>
HTML, 3);

        $this->makeSub($topic, 'Transition Planning and Handover', <<<HTML
<h3>Planning for Transition</h3>
<p>Transition planning involves preparing for the handover of project responsibilities, assets, and functions to local actors — typically the government health system, community organisations, or local NGOs. Transition planning should begin early in the project life cycle, not just at the end, to allow sufficient time for capacity building and gradual transfer of responsibilities.</p>
<h3>Key Elements of a Transition Plan</h3>
<ul>
  <li><strong>Transition timeline:</strong> A phased schedule showing when specific responsibilities will be transferred and to whom.</li>
  <li><strong>Capacity assessment:</strong> An assessment of the capacity of receiving organisations to take on transferred responsibilities, with a plan to address capacity gaps.</li>
  <li><strong>Asset transfer plan:</strong> Documentation of all project assets and a plan for their transfer, including any donor approval requirements.</li>
  <li><strong>Knowledge transfer plan:</strong> A plan for transferring technical knowledge, systems, and documentation to receiving organisations.</li>
  <li><strong>Risk assessment:</strong> Identification of risks associated with the transition and mitigation measures.</li>
</ul>
<h3>Government Handover in South Sudan</h3>
<p>Handing over health project functions to the South Sudan government requires careful planning given the limited absorptive capacity of the health system. Successful handovers typically involve: joint planning with government counterparts from the project design stage; gradual transfer of responsibilities with ongoing technical support; advocacy for government budget allocation to sustain transferred functions; and post-handover monitoring to identify and address emerging challenges.</p>
<p>Documenting the handover process formally — through handover reports, asset transfer certificates, and MoU amendments — protects both the project and the government and provides a clear record for future reference.</p>
HTML, 4);
    }

    // =========================================================================
    // EXAM QUESTIONS (40 total — distributed A/B/C/D ≤ 50% each)
    // Distribution: A=10, B=10, C=10, D=10
    // =========================================================================
    private function seedQuestions(Course $course): void
    {
        $questions = [
            // Q1 — A
            ['question' => 'Which of the following best describes a health project?',
             'a' => 'A temporary, goal-oriented initiative with defined resources and a clear start and end date',
             'b' => 'An ongoing routine health service delivered by a government facility',
             'c' => 'A collection of related programmes managed under a single ministry',
             'd' => 'A long-term strategic plan for national health system development',
             'answer' => 'A',
             'explanation' => 'A health project is temporary and goal-oriented with defined resources, distinguishing it from routine service delivery or long-term programmes.'],

            // Q2 — B
            ['question' => 'What does the acronym LFA stand for in health project management?',
             'a' => 'Local Funding Arrangement',
             'b' => 'Logical Framework Approach',
             'c' => 'Linear Financial Analysis',
             'd' => 'Long-term Feasibility Assessment',
             'answer' => 'B',
             'explanation' => 'LFA stands for Logical Framework Approach, a planning tool widely used by UN agencies and NGOs for donor-funded health projects.'],

            // Q3 — C
            ['question' => 'In a logframe, which level describes the tangible products or services the project will deliver?',
             'a' => 'Goal',
             'b' => 'Purpose',
             'c' => 'Outputs',
             'd' => 'Impact',
             'answer' => 'C',
             'explanation' => 'Outputs are the tangible products or services delivered by the project (e.g., 50 midwives trained), distinct from the goal (broader objective) and purpose (specific change).'],

            // Q4 — D
            ['question' => 'Which project life cycle phase involves developing detailed plans for scope, schedule, budget, and risk?',
             'a' => 'Initiation',
             'b' => 'Execution',
             'c' => 'Closure',
             'd' => 'Planning',
             'answer' => 'D',
             'explanation' => 'The Planning phase is where detailed project plans are developed, including the WBS, schedule, budget, risk register, and communication plan.'],

            // Q5 — A
            ['question' => 'What does a RACI matrix define for each project activity?',
             'a' => 'Who is Responsible, Accountable, Consulted, and Informed',
             'b' => 'Resources, Activities, Costs, and Indicators',
             'c' => 'Risks, Assumptions, Constraints, and Issues',
             'd' => 'Reporting, Auditing, Compliance, and Implementation',
             'answer' => 'A',
             'explanation' => 'A RACI matrix clarifies roles by specifying who is Responsible (does the work), Accountable (owns the outcome), Consulted (provides input), and Informed (kept updated).'],

            // Q6 — B
            ['question' => 'What is the primary purpose of a Work Breakdown Structure (WBS)?',
             'a' => 'To identify project stakeholders and their interests',
             'b' => 'To decompose project scope into manageable work packages',
             'c' => 'To calculate the critical path of the project schedule',
             'd' => 'To document project risks and mitigation strategies',
             'answer' => 'B',
             'explanation' => 'The WBS hierarchically decomposes the total project scope into manageable work packages, forming the foundation for scheduling, budgeting, and risk management.'],

            // Q7 — C
            ['question' => 'Which scheduling tool displays project activities as horizontal bars against a timeline?',
             'a' => 'Network diagram',
             'b' => 'Risk matrix',
             'c' => 'Gantt chart',
             'd' => 'Stakeholder map',
             'answer' => 'C',
             'explanation' => 'A Gantt chart is a horizontal bar chart showing project activities against a timeline, widely used for its simplicity and visual clarity.'],

            // Q8 — D
            ['question' => 'In South Sudan, which factor most commonly causes delays in health project schedules?',
             'a' => 'Excessive staff capacity',
             'b' => 'Over-funding by donors',
             'c' => 'Lack of community interest',
             'd' => 'Rainy season road inaccessibility and security constraints',
             'answer' => 'D',
             'explanation' => 'Rainy season road inaccessibility and security constraints are among the most significant contextual factors causing schedule delays in South Sudan health projects.'],

            // Q9 — A
            ['question' => 'What is a "burn rate" in project financial management?',
             'a' => 'The rate at which the project is spending its budget relative to the implementation timeline',
             'b' => 'The interest rate charged on project loans',
             'c' => 'The rate of staff turnover in the project team',
             'd' => 'The speed at which project documents are processed',
             'answer' => 'A',
             'explanation' => 'Burn rate measures how quickly the project is spending its budget relative to the timeline, helping identify implementation delays or overspending.'],

            // Q10 — B
            ['question' => 'Which internal financial control ensures that the person authorising a payment is not the same person making the payment?',
             'a' => 'Asset register',
             'b' => 'Segregation of duties',
             'c' => 'Bank reconciliation',
             'd' => 'Expenditure verification',
             'answer' => 'B',
             'explanation' => 'Segregation of duties is a key internal control that prevents fraud by ensuring no single person controls all aspects of a financial transaction.'],

            // Q11 — C
            ['question' => 'What metric is most commonly used in health cost-effectiveness analysis?',
             'a' => 'Cost per staff member trained',
             'b' => 'Cost per facility constructed',
             'c' => 'Cost per DALY averted',
             'd' => 'Cost per report submitted',
             'answer' => 'C',
             'explanation' => 'Cost per DALY (Disability-Adjusted Life Year) averted is the standard metric in health CEA, allowing comparison of different interventions\' efficiency.'],

            // Q12 — D
            ['question' => 'Which motivation theory distinguishes between hygiene factors (which prevent dissatisfaction) and motivators (which drive engagement)?',
             'a' => 'Maslow\'s Hierarchy of Needs',
             'b' => 'Self-Determination Theory',
             'c' => 'Expectancy Theory',
             'd' => 'Herzberg\'s Two-Factor Theory',
             'answer' => 'D',
             'explanation' => 'Herzberg\'s Two-Factor Theory distinguishes hygiene factors (salary, working conditions) that prevent dissatisfaction from motivators (recognition, achievement) that drive positive engagement.'],

            // Q13 — A
            ['question' => 'What is the recommended conflict resolution approach for most project team conflicts?',
             'a' => 'Confronting/Problem-solving — addressing the conflict directly and finding a mutually acceptable solution',
             'b' => 'Forcing — using authority to impose a solution immediately',
             'c' => 'Avoiding — ignoring the conflict and hoping it resolves itself',
             'd' => 'Smoothing — pretending the conflict does not exist',
             'answer' => 'A',
             'explanation' => 'Confronting/Problem-solving is the most effective conflict resolution approach as it addresses root causes and produces mutually acceptable solutions.'],

            // Q14 — B
            ['question' => 'What does a SMART indicator require in terms of time?',
             'a' => 'It must be measured annually without exception',
             'b' => 'It must be Time-bound with a specific measurement period or deadline',
             'c' => 'It must be measured in real-time using digital tools',
             'd' => 'It must align with the South Sudan fiscal year',
             'answer' => 'B',
             'explanation' => 'The "T" in SMART stands for Time-bound — the indicator must specify when it will be measured and by what deadline the target should be achieved.'],

            // Q15 — C
            ['question' => 'Which data collection platform is used by the South Sudan Ministry of Health for routine health information?',
             'a' => 'KoBoToolbox',
             'b' => 'REDCap',
             'c' => 'DHIS2',
             'd' => 'SurveyCTO',
             'answer' => 'C',
             'explanation' => 'DHIS2 (District Health Information Software 2) is the national health information system used by the South Sudan Ministry of Health for routine health data collection and reporting.'],

            // Q16 — D
            ['question' => 'Which type of evaluation is conducted at the midpoint of a project to assess progress and recommend adjustments?',
             'a' => 'Baseline assessment',
             'b' => 'Endline evaluation',
             'c' => 'Real-time evaluation',
             'd' => 'Midterm evaluation',
             'answer' => 'D',
             'explanation' => 'A midterm evaluation is conducted at the project midpoint to assess progress, identify challenges, and recommend adjustments to improve project performance.'],

            // Q17 — A
            ['question' => 'In risk management, what does "mitigate" mean as a risk response strategy?',
             'a' => 'Reduce the probability or impact of the risk through proactive action',
             'b' => 'Transfer the risk to a third party through insurance',
             'c' => 'Eliminate the risk by changing the project plan',
             'd' => 'Accept the risk without taking any action',
             'answer' => 'A',
             'explanation' => 'Mitigation involves taking proactive steps to reduce either the probability of a risk occurring or the severity of its impact if it does occur.'],

            // Q18 — B
            ['question' => 'Which organisation provides security information and support to NGOs operating in South Sudan?',
             'a' => 'OCHA',
             'b' => 'INSO (International NGO Safety Organisation)',
             'c' => 'WHO',
             'd' => 'UNICEF',
             'answer' => 'B',
             'explanation' => 'INSO (International NGO Safety Organisation) specifically provides security information, analysis, and support to NGOs operating in conflict-affected contexts including South Sudan.'],

            // Q19 — C
            ['question' => 'In a stakeholder matrix, how should stakeholders with high influence but low interest be managed?',
             'a' => 'Engage closely as key players',
             'b' => 'Monitor with minimal engagement',
             'c' => 'Keep satisfied',
             'd' => 'Keep informed with regular updates',
             'answer' => 'C',
             'explanation' => 'Stakeholders with high influence but low interest should be kept satisfied — they have the power to affect the project but are not deeply engaged, so managing their expectations is key.'],

            // Q20 — D
            ['question' => 'Which communication channel is most effective for reaching rural populations with low literacy in South Sudan?',
             'a' => 'Email newsletters',
             'b' => 'Social media posts',
             'c' => 'Printed brochures',
             'd' => 'Community radio broadcasts in local languages',
             'answer' => 'D',
             'explanation' => 'Community radio in local languages is the most effective channel for reaching rural populations with low literacy rates in South Sudan, given limited internet access and high radio penetration.'],
        ];

        foreach ($questions as $i => $q) {
            $this->makeQuestion($course, $q, $i + 1);
        }

        $this->seedQuestions2($course);
    }

    private function seedQuestions2(Course $course): void
    {
        $questions = [
            // Q21 — A
            ['question' => 'What is the primary purpose of a project charter in the initiation phase?',
             'a' => 'To formally authorise the project and define its high-level scope, objectives, and stakeholders',
             'b' => 'To provide a detailed budget breakdown for donor approval',
             'c' => 'To document all project risks and their mitigation strategies',
             'd' => 'To assign specific tasks to individual team members',
             'answer' => 'A',
             'explanation' => 'A project charter formally authorises the project, defines its high-level scope and objectives, identifies key stakeholders, and gives the project manager authority to proceed.'],

            // Q22 — B
            ['question' => 'Which procurement document is most appropriate for complex services requiring technical evaluation?',
             'a' => 'Request for Quotation (RFQ)',
             'b' => 'Request for Proposal (RFP)',
             'c' => 'Invitation to Bid (ITB)',
             'd' => 'Purchase Order (PO)',
             'answer' => 'B',
             'explanation' => 'An RFP is used for complex services where technical quality is as important as price, allowing evaluation of both technical and financial proposals.'],

            // Q23 — C
            ['question' => 'What is the Theory of Change (ToC) in health project design?',
             'a' => 'A financial model for projecting project costs over time',
             'b' => 'A risk assessment tool for identifying project threats',
             'c' => 'A causal pathway describing how project activities lead to desired health outcomes',
             'd' => 'A legal framework governing project implementation in South Sudan',
             'answer' => 'C',
             'explanation' => 'A Theory of Change maps the causal pathway from project inputs and activities through outputs and outcomes to impact, explaining the assumptions underlying the causal chain.'],

            // Q24 — D
            ['question' => 'Which of the following is a key challenge for human resource management in South Sudan health projects?',
             'a' => 'Excessive number of qualified health professionals',
             'b' => 'Over-supply of trained midwives and nurses',
             'c' => 'Strong government capacity to absorb project staff',
             'd' => 'Severe shortage of qualified health professionals and intense competition for staff',
             'answer' => 'D',
             'explanation' => 'South Sudan has one of the lowest health worker-to-population ratios globally, creating intense competition for qualified staff among NGOs, UN agencies, and government.'],

            // Q25 — A
            ['question' => 'What is adaptive management in the context of health project MEL?',
             'a' => 'Adjusting project activities based on evidence from monitoring and evaluation data',
             'b' => 'Changing the project budget without donor approval',
             'c' => 'Replacing project staff when performance targets are not met',
             'd' => 'Modifying the project logframe after the baseline assessment',
             'answer' => 'A',
             'explanation' => 'Adaptive management involves using MEL evidence to make informed adjustments to project activities, improving effectiveness in dynamic environments like South Sudan.'],

            // Q26 — B
            ['question' => 'What is the purpose of a contingency reserve in a project budget?',
             'a' => 'To fund staff salary increases during the project',
             'b' => 'To cover the financial impact of identified project risks',
             'c' => 'To pay for project closure activities',
             'd' => 'To fund additional activities beyond the original project scope',
             'answer' => 'B',
             'explanation' => 'A contingency reserve is a budget allowance set aside to cover the financial impact of identified risks that may materialise during project implementation.'],

            // Q27 — C
            ['question' => 'Which dimension of sustainability refers to the ability of local institutions to continue project activities after funding ends?',
             'a' => 'Financial sustainability',
             'b' => 'Technical sustainability',
             'c' => 'Institutional sustainability',
             'd' => 'Political sustainability',
             'answer' => 'C',
             'explanation' => 'Institutional sustainability refers to the capacity of local organisations (government departments, community groups) to continue managing and delivering project services after external support ends.'],

            // Q28 — D
            ['question' => 'What is the main purpose of an After-Action Review (AAR) at project closure?',
             'a' => 'To assess the financial performance of the project against the budget',
             'b' => 'To evaluate individual staff performance for HR records',
             'c' => 'To prepare the final donor report',
             'd' => 'To capture lessons learned by analysing what was planned, what happened, and why',
             'answer' => 'D',
             'explanation' => 'An AAR is a structured reflection process that captures lessons learned by examining the gap between planned and actual outcomes and identifying implications for future projects.'],

            // Q29 — A
            ['question' => 'In the context of South Sudan health projects, what does "duty of care" require of project managers?',
             'a' => 'Protecting staff wellbeing including security, medical care, and psychosocial support',
             'b' => 'Ensuring all project reports are submitted on time',
             'c' => 'Maintaining accurate financial records for audit purposes',
             'd' => 'Complying with donor procurement regulations',
             'answer' => 'A',
             'explanation' => 'Duty of care requires project managers to protect staff wellbeing, including providing security briefings, medical care access, evacuation procedures, and psychosocial support.'],

            // Q30 — B
            ['question' => 'Which coordination mechanism brings together health actors in humanitarian settings in South Sudan?',
             'a' => 'Technical Working Group',
             'b' => 'Health Cluster',
             'c' => 'Project Steering Committee',
             'd' => 'Donor Coordination Forum',
             'answer' => 'B',
             'explanation' => 'The Health Cluster is the primary coordination mechanism for health actors in humanitarian settings in South Sudan, co-chaired by WHO and the Ministry of Health.'],

            // Q31 — C
            ['question' => 'What is the Finish-to-Start (FS) dependency in project scheduling?',
             'a' => 'Activity B cannot finish until Activity A starts',
             'b' => 'Activity B cannot start until Activity A starts',
             'c' => 'Activity B cannot start until Activity A finishes',
             'd' => 'Activity B cannot finish until Activity A finishes',
             'answer' => 'C',
             'explanation' => 'Finish-to-Start (FS) is the most common dependency type: Activity B cannot begin until Activity A is complete.'],

            // Q32 — D
            ['question' => 'Which PESTLE factor would include analysis of South Sudan\'s NGO Act and health regulations?',
             'a' => 'Political',
             'b' => 'Economic',
             'c' => 'Social',
             'd' => 'Legal',
             'answer' => 'D',
             'explanation' => 'The Legal component of PESTLE analysis covers laws and regulations, including South Sudan\'s NGO Act, Labour Act, and health sector regulations.'],

            // Q33 — A
            ['question' => 'What is the primary benefit of using KoBoToolbox or ODK for data collection in South Sudan health projects?',
             'a' => 'Mobile data collection that works offline and reduces data entry errors',
             'b' => 'Automatic submission of reports to the Ministry of Health',
             'c' => 'Real-time GPS tracking of health workers',
             'd' => 'Automatic translation of data into local languages',
             'answer' => 'A',
             'explanation' => 'KoBoToolbox and ODK enable mobile data collection that works offline in areas with poor connectivity, reducing data entry errors and improving data quality.'],

            // Q34 — B
            ['question' => 'What is the purpose of a Most Significant Change (MSC) technique in project evaluation?',
             'a' => 'To calculate the statistical significance of project outcomes',
             'b' => 'To collect stories of significant change from project beneficiaries',
             'c' => 'To identify the most significant risks facing the project',
             'd' => 'To measure changes in health facility infrastructure',
             'answer' => 'B',
             'explanation' => 'MSC is a participatory evaluation technique that collects stories of significant change from beneficiaries, providing rich qualitative evidence of project impact.'],

            // Q35 — C
            ['question' => 'Which financial risk is particularly significant for South Sudan health projects due to the country\'s economic instability?',
             'a' => 'Interest rate risk on project loans',
             'b' => 'Stock market volatility affecting project investments',
             'c' => 'Currency devaluation of the South Sudanese Pound (SSP)',
             'd' => 'Tax liability on project income',
             'answer' => 'C',
             'explanation' => 'The SSP has experienced significant devaluation, creating currency risk for projects budgeted in hard currencies — a major financial management challenge in South Sudan.'],

            // Q36 — D
            ['question' => 'What is the recommended approach for transition planning in South Sudan health projects?',
             'a' => 'Begin transition planning only in the final month of the project',
             'b' => 'Transfer all responsibilities to government on the last day of the project',
             'c' => 'Avoid transition planning to maintain project flexibility',
             'd' => 'Begin transition planning early in the project life cycle with gradual transfer of responsibilities',
             'answer' => 'D',
             'explanation' => 'Transition planning should begin early to allow sufficient time for capacity building and gradual transfer of responsibilities, rather than an abrupt handover at project end.'],

            // Q37 — A
            ['question' => 'What does the "acceptance" risk response strategy involve?',
             'a' => 'Acknowledging the risk and deciding not to take proactive action',
             'b' => 'Transferring the risk to an insurance company',
             'c' => 'Eliminating the risk by changing the project plan',
             'd' => 'Reducing the probability of the risk through mitigation measures',
             'answer' => 'A',
             'explanation' => 'Risk acceptance means acknowledging a risk exists but deciding not to take proactive action, either because it is low priority or no cost-effective response is available.'],

            // Q38 — B
            ['question' => 'Which element of a MEL framework specifies how, when, and by whom data will be collected for each indicator?',
             'a' => 'Results framework',
             'b' => 'Data collection plan',
             'c' => 'Learning agenda',
             'd' => 'Evaluation plan',
             'answer' => 'B',
             'explanation' => 'The data collection plan specifies the methods, timing, and responsible parties for collecting data on each project indicator.'],

            // Q39 — C
            ['question' => 'What is the primary purpose of a Memorandum of Understanding (MoU) between a health project and the South Sudan government?',
             'a' => 'To transfer project assets to the government at project closure',
             'b' => 'To satisfy donor reporting requirements',
             'c' => 'To formally define roles, responsibilities, and resource contributions between the project and government',
             'd' => 'To register the project with the Ministry of Justice',
             'answer' => 'C',
             'explanation' => 'An MoU is a formal agreement that defines the roles, responsibilities, and resource contributions of each party, providing a framework for collaboration between the project and government.'],

            // Q40 — D
            ['question' => 'Which of the following best describes the concept of "scope creep" in health project management?',
             'a' => 'The gradual improvement of project quality over time',
             'b' => 'The natural expansion of the project team as implementation progresses',
             'c' => 'The process of refining project scope during the planning phase',
             'd' => 'The uncontrolled expansion of project work without corresponding adjustments to time, cost, or resources',
             'answer' => 'D',
             'explanation' => 'Scope creep is the uncontrolled addition of work beyond the agreed project scope without adjusting the schedule, budget, or resources — a common challenge in South Sudan health projects.'],
        ];

        foreach ($questions as $i => $q) {
            $this->makeQuestion($course, $q, $i + 21);
        }
    }

    // =========================================================================
    // DOWNLOADS
    // =========================================================================
    private function seedDownloads(Course $course): void
    {
        $this->makeDownload(
            $course,
            'Health Project Management Course Handbook',
            'health-project-management-course-handbook.pdf',
            'application/pdf',
            2457600  // ~2.4 MB
        );

        $this->makeDownload(
            $course,
            'Project Planning Template (Excel)',
            'health-project-planning-template.xlsx',
            'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
            184320   // ~180 KB
        );
    }
}
