<?php

namespace Database\Seeders;

use App\Models\User;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;

class SenegalMembersSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        $senegalNames = [
            ['Abdoulaye', 'Wade'],
            ['Macky', 'Sall'],
            ['Ousmane', 'Sonko'],
            ['Aminata', 'Touré'],
            ['Idrissa', 'Seck'],
            ['Khalifa', 'Sall'],
            ['Barthélémy', 'Dias'],
            ['Youssou', "N'Dour"],
            ['Sadio', 'Mané'],
            ['Kalidou', 'Koulibaly'],
            ['Ismaila', 'Sarr'],
            ['Cheikhou', 'Kouyaté'],
            ['Gana', 'Gueye'],
            ['Edouard', 'Mendy'],
            ['Aliou', 'Cissé'],
            ['Babacar', 'Sarr'],
            ['Seydou', 'Gueye'],
            ['Mariama', 'Sarr'],
            ['Aida', 'Mbodj'],
            ['Fatoumata', 'Tall']
        ];

        foreach ($senegalNames as $index => $namePair) {
            $firstName = $namePair[0];
            $lastName = $namePair[1];
            $email = strtolower(Str::slug($firstName . '.' . $lastName)) . $index . '@example.com';

            User::create([
                'name' => strtolower($firstName . $index),
                'first_name' => $firstName,
                'last_name' => $lastName,
                'email' => $email,
                'password' => Hash::make('gasos2026'),
                'phone' => '+221 77 ' . rand(100, 999) . ' ' . rand(10, 99) . ' ' . rand(10, 99),
                'cni' => 'SN' . rand(100000000, 999999999),
                'gender' => ($index % 4 == 3) ? 'femme' : 'homme',
                'nationality' => 'Sénégalaise',
                'residence' => 'Sénégal',
                'address' => 'Quartier ' . ($index + 1) . ', Dakar',
                'role' => 'membre',
                'status' => 'active',
                'registration_number' => 'SENEVALLS-' . sprintf('%04d', 100 + $index),
            ]);
        }
    }
}
