<?php
declare(strict_types=1);

use App\Core\Database;

return function (Database $db): void {
    $qualifications = [
        ['code' => 'high',   'name_ar' => 'مؤهل عالي',   'name_en' => 'High Qualification',   'sort_order' => 1],
        ['code' => 'medium', 'name_ar' => 'مؤهل متوسط',  'name_en' => 'Medium Qualification', 'sort_order' => 2],
        ['code' => 'none',   'name_ar' => 'بدون مؤهل',   'name_en' => 'No Qualification',     'sort_order' => 3],
    ];

    foreach ($qualifications as $q) {
        $existing = $db->selectOne("SELECT id FROM qualifications WHERE code = ?", [$q['code']]);
        if ($existing) {
            continue;
        }
        $db->insert('qualifications', [
            'code'       => $q['code'],
            'name_ar'    => $q['name_ar'],
            'name_en'    => $q['name_en'],
            'sort_order' => $q['sort_order'],
            'is_active'  => 1,
        ]);
    }
};