<?php

namespace Database\Seeders;

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

class UserSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        $users = [
            [
                'id' => 1,
                'profile' => 'storage/profile/avatar.webp',
                'name' => 'Admin',
                'email' => 'admin@gmail.com',
                'phone' => '01777777777',
                'role' => 'admin',
                'password' => Hash::make(12345678),
                'create_by' => 1,
                'created_at' => Carbon::now(),
                'updated_at' => Carbon::now(),
            ],
            [
                'id' => 2,
                'profile' => 'storage/profile/avatar.webp',
                'name' => 'User',
                'email' => 'user@gmail.com',
                'phone' => '01777777778',
                'role' => 'user',
                'password' => Hash::make(12345678),
                'create_by' => 1,
                'created_at' => Carbon::now(),
                'updated_at' => Carbon::now(),
            ],
            [
                'id' => 3,
                'profile' => 'storage/profile/avatar.webp',
                'name' => 'Staff',
                'email' => 'staff@gmail.com',
                'phone' => '01777777779',
                'role' => 'staff',
                'password' => Hash::make(12345678),
                'create_by' => 2,
                'created_at' => Carbon::now(),
                'updated_at' => Carbon::now(),
            ],
        ];
        if (User::query()->count() === 0) {
            User::query()->insert($users);
        }
    }
}
