<?php

namespace Database\Seeders;

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

/**
 * DiscussionTopicSeeder
 *
 * Seeds five foundational discussion topics for the SSHIA knowledge-sharing
 * platform. These topics provide the primary organisational structure for
 * member-led discussions, enabling health informatics professionals across
 * South Sudan to engage in focused, domain-specific conversations that
 * advance the collective knowledge and practice of the profession.
 *
 * Topics are crafted with SEO-optimised descriptions to improve discoverability
 * through Google Search Console and other search engines.
 *
 * Uses updateOrCreate keyed on slug for idempotency — safe to re-run.
 */
class DiscussionTopicSeeder extends Seeder
{
    public function run(): void
    {
        $topics = [
            [
                'name'             => 'Clinical Practice',
                'slug'             => 'clinical-practice',
                'description'      => 'A dedicated forum for SSHIA members to discuss clinical practice challenges, share evidence-based solutions, and explore the role of health informatics in improving patient care across South Sudan\'s health facilities. Topics include clinical decision support, electronic medical records, patient safety, and the integration of digital tools into clinical workflows.',
                'icon'             => 'fa-stethoscope',
                'color'            => 'red',
                'is_active'        => true,
                'sort_order'       => 1,
                'meta_title'       => 'Clinical Practice Discussions — SSHIA Health Informatics Forum',
                'meta_description' => 'Join SSHIA members in discussing clinical practice, health informatics tools, and evidence-based approaches to improving patient care in South Sudan.',
                'meta_keywords'    => 'clinical practice, health informatics, patient care, South Sudan, electronic medical records',
            ],
            [
                'name'             => 'Health Policy',
                'slug'             => 'health-policy',
                'description'      => 'An open forum for SSHIA members, policymakers, and health advocates to discuss national and international health policies, regulatory frameworks, and governance issues affecting the health informatics sector in South Sudan. Engage with peers on topics such as the National Health Information System strategy, data governance, health financing, and the implementation of global health standards in low-resource settings.',
                'icon'             => 'fa-landmark',
                'color'            => 'blue',
                'is_active'        => true,
                'sort_order'       => 2,
                'meta_title'       => 'Health Policy Discussions — SSHIA Health Informatics Forum',
                'meta_description' => 'Discuss health policy, governance, and regulatory frameworks shaping health informatics in South Sudan with SSHIA members and policymakers.',
                'meta_keywords'    => 'health policy, health governance, South Sudan health system, health informatics policy, data governance',
            ],
            [
                'name'             => 'Research & Innovation',
                'slug'             => 'research-innovation',
                'description'      => 'A collaborative space for SSHIA researchers, academics, and innovators to share research findings, discuss methodologies, explore emerging technologies, and identify opportunities for health informatics innovation in South Sudan. Topics include mHealth, artificial intelligence in healthcare, health data analytics, telemedicine, and the development of locally relevant digital health solutions.',
                'icon'             => 'fa-flask',
                'color'            => 'purple',
                'is_active'        => true,
                'sort_order'       => 3,
                'meta_title'       => 'Research & Innovation Discussions — SSHIA Health Informatics Forum',
                'meta_description' => 'Explore health informatics research, digital health innovation, and emerging technologies with SSHIA researchers and innovators in South Sudan.',
                'meta_keywords'    => 'health informatics research, digital health innovation, mHealth, AI in healthcare, South Sudan health technology',
            ],
            [
                'name'             => 'Training & Education',
                'slug'             => 'training-education',
                'description'      => 'A forum for SSHIA members to discuss capacity-building initiatives, share training resources, and explore best practices in health informatics education. Topics include curriculum development, continuing professional development, e-learning platforms, training programme design, and strategies for building a skilled health informatics workforce in South Sudan.',
                'icon'             => 'fa-graduation-cap',
                'color'            => 'green',
                'is_active'        => true,
                'sort_order'       => 4,
                'meta_title'       => 'Training & Education Discussions — SSHIA Health Informatics Forum',
                'meta_description' => 'Discuss health informatics training, capacity building, and professional development opportunities with SSHIA members across South Sudan.',
                'meta_keywords'    => 'health informatics training, capacity building, professional development, health education, South Sudan',
            ],
            [
                'name'             => 'General Discussion',
                'slug'             => 'general-discussion',
                'description'      => 'An open forum for SSHIA members to connect, share news, discuss general health informatics topics, and engage with the broader professional community. This space welcomes introductions, announcements, career advice, event updates, and any health informatics conversations that do not fit neatly into the other topic categories.',
                'icon'             => 'fa-comments',
                'color'            => 'gray',
                'is_active'        => true,
                'sort_order'       => 5,
                'meta_title'       => 'General Discussions — SSHIA Health Informatics Community Forum',
                'meta_description' => 'Connect with SSHIA members, share news, and discuss general health informatics topics in the SSHIA community forum.',
                'meta_keywords'    => 'SSHIA community, health informatics forum, South Sudan health professionals, networking',
            ],
        ];

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

        $this->command->info('DiscussionTopicSeeder: 5 discussion topics seeded successfully.');
    }
}
