<?php

namespace Database\Seeders;

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

class DatabaseSeeder extends Seeder
{
    public function run(): void
    {
        // Create the single admin account
        User::updateOrCreate(
            ['email' => 'admin@esp32.local'],
            [
                'name'     => 'Admin',
                'email'    => 'admin@esp32.local',
                'password' => Hash::make('Admin@1234'),
            ]
        );

        // Create the default device record
        Device::updateOrCreate(
            ['id' => 1],
            [
                'name'             => 'Ebad',
                'goal'             => 'Finish Laravel',
                'weather'          => '37°C',
                'quote'            => 'Keep Learning',
                'brightness'       => 80,
                'animation'        => 'happy',
                'refresh'          => 30,
                'current_ip'       => null,
                'wifi_strength'    => null,
                'firmware_version' => 'v1.0.0',
                'last_seen'        => null,
            ]
        );
    }
}
