<?php

namespace Database\Seeders;

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

class CourseSeeder extends Seeder
{
    public function run(): void
    {
        $courses = [
            'Pharmacology',
            'Pharmaceutics',
            'Medicinal Chemistry',
            'Pharmacokinetics',
            'Pharmacy Calculations',
            'Clinical Pharmacy',
            'Pharmacotherapy',
            'Hospital Pharmacy',
            'Pharmacognosy',
            'Toxicology',
            'Pharmaceutical Microbiology',
            'Quality Control / Assurance',
            'Pharmacy Law and Ethics',
        ];

        foreach ($courses as $index => $course) {
            DB::table('courses')->updateOrInsert(
                ['slug' => Str::slug($course)],
                [
                    'name' => $course,
                    'description' => $course . ' exam preparation questions and learning materials.',
                    'is_active' => true,
                    'sort_order' => $index + 1,
                    'created_at' => now(),
                    'updated_at' => now(),
                ]
            );
        }
    }
}