<?php

namespace Database\Seeders;

use App\Models\User;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\Hash;

class AdminUserSeeder extends Seeder
{
    public function run(): void
    {
        $admin = User::firstOrCreate(
            ['mobile' => '9999999999'],
            [
                'name' => 'Admin User',
                'email' => 'admin@kiyokart.com',
                'password' => Hash::make('password'), // Change in production via tinker
            ]
        );

        $admin->assignRole('admin');

        $this->command->info('Admin user created with mobile: 9999999999');
        $this->command->info('IMPORTANT: Change the password via tinker in production!');
        $this->command->info('Example: User::where("mobile", "9999999999")->first()->update(["password" => Hash::make("your-secure-password")]);');
    }
}
