<?php

namespace App\Database\Seeds;

use CodeIgniter\Database\Seeder;

class AdminUserSeeder extends Seeder
{
    public function run()
    {
        $email = 'admin@quantum.local';
        $existing = $this->db->table('users')->where('email', $email)->get()->getRowArray();

        if ($existing) {
            return;
        }

        $now = date('Y-m-d H:i:s');

        $this->db->table('users')->insert([
            'name' => 'Quantum Admin',
            'email' => $email,
            'password_hash' => password_hash('Admin123!', PASSWORD_DEFAULT),
            'role' => 'admin',
            'status' => 'active',
            'created_at' => $now,
            'updated_at' => $now,
        ]);
    }
}
