<?php

namespace Database\Seeders;

use App\Models\TrainingCategory;
use Illuminate\Database\Seeder;
use Illuminate\Support\Str;

/**
 * TrainingCategorySeeder
 *
 * Seeds the six official SSHIA training categories that underpin the
 * capacity-building mandate of the South Sudan Health Informatics Association.
 * These categories reflect the core competency domains required to strengthen
 * health information systems and professional practice across South Sudan.
 *
 * Uses updateOrCreate keyed on slug for idempotency — safe to re-run.
 */
class TrainingCategorySeeder extends Seeder
{
    public function run(): void
    {
        $categories = [
            [
                'name'        => 'Clinical Skills',
                'slug'        => 'clinical-skills',
                'description' => 'Structured training programmes designed to enhance the clinical competencies of health professionals in South Sudan. Covers patient assessment, clinical decision-making, evidence-based practice, and the application of health informatics tools at the point of care to improve patient outcomes.',
                'icon'        => 'fa-stethoscope',
                'color'       => '#dc2626',
                'sort_order'  => 1,
                'is_active'   => true,
            ],
            [
                'name'        => 'Health Management',
                'slug'        => 'health-management',
                'description' => 'Capacity-building programmes for health facility managers, district health officers, and public health administrators. Topics include health systems strengthening, resource management, supply chain, health facility governance, and the use of digital tools for operational efficiency in low-resource settings.',
                'icon'        => 'fa-hospital',
                'color'       => '#2563eb',
                'sort_order'  => 2,
                'is_active'   => true,
            ],
            [
                'name'        => 'Public Health',
                'slug'        => 'public-health',
                'description' => 'Training in epidemiology, disease surveillance, outbreak response, community health promotion, and population-level health interventions. Equips health professionals with the skills to collect, analyse, and act on public health data to reduce the burden of communicable and non-communicable diseases in South Sudan.',
                'icon'        => 'fa-globe-africa',
                'color'       => '#16a34a',
                'sort_order'  => 3,
                'is_active'   => true,
            ],
            [
                'name'        => 'Research Methods',
                'slug'        => 'research-methods',
                'description' => 'Rigorous training in health research design, data collection methodologies, biostatistics, qualitative and quantitative analysis, and scientific writing. Supports SSHIA members in producing peer-reviewed research that informs health policy and practice in South Sudan and the broader East African region.',
                'icon'        => 'fa-microscope',
                'color'       => '#7c3aed',
                'sort_order'  => 4,
                'is_active'   => true,
            ],
            [
                'name'        => 'Leadership & Governance',
                'slug'        => 'leadership-governance',
                'description' => 'Programmes that develop transformational health leaders capable of driving institutional reform, policy advocacy, and strategic planning within South Sudan\'s health sector. Covers health governance frameworks, stakeholder engagement, change management, and ethical leadership in resource-constrained environments.',
                'icon'        => 'fa-landmark',
                'color'       => '#d97706',
                'sort_order'  => 5,
                'is_active'   => true,
            ],
            [
                'name'        => 'Digital Health',
                'slug'        => 'digital-health',
                'description' => 'Cutting-edge training on health information systems, electronic medical records, mHealth applications, telemedicine, health data standards (HL7, FHIR), and the use of digital technologies to transform health service delivery. Prepares South Sudanese health professionals to lead the digital transformation of the national health system.',
                'icon'        => 'fa-laptop-medical',
                'color'       => '#0891b2',
                'sort_order'  => 6,
                'is_active'   => true,
            ],
        ];

        foreach ($categories as $data) {
            TrainingCategory::updateOrCreate(
                ['slug' => $data['slug']],
                $data
            );
        }

        $this->command->info('TrainingCategorySeeder: 6 training categories seeded successfully.');
    }
}
