<?php

namespace Database\Seeders;

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

class UserSeeder extends Seeder
{
    public function run(): void
    {
        // Admin user
        User::firstOrCreate(
            ['email' => 'admin@askeribilgiler.com'],
            [
                'name'     => 'Süper Admin',
                'password' => Hash::make('password'),
                'role'     => 'admin',
                'points'   => 1000,
                'bio'      => 'Platform yöneticisi',
                'status'   => 'active',
            ]
        );

        // Demo users
        $demoUsers = [
            ['name' => 'Ahmet Yılmaz', 'email' => 'ahmet@example.com', 'role' => 'user'],
            ['name' => 'Mehmet Demir', 'email' => 'mehmet@example.com', 'role' => 'user'],
            ['name' => 'Ayşe Kaya', 'email' => 'ayse@example.com', 'role' => 'user'],
            ['name' => 'Fatma Çelik', 'email' => 'fatma@example.com', 'role' => 'moderator'],
            ['name' => 'Ali Şahin', 'email' => 'ali@example.com', 'role' => 'editor'],
        ];

        foreach ($demoUsers as $user) {
            User::firstOrCreate(
                ['email' => $user['email']],
                [
                    'name'     => $user['name'],
                    'password' => Hash::make('password'),
                    'role'     => $user['role'],
                    'points'   => rand(0, 500),
                    'status'   => 'active',
                ]
            );
        }
    }
}
