<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    public function up(): void
    {
        Schema::create('agents', function (Blueprint $table) {
            $table->id();
            $table->string('username')->unique();
            $table->string('password');
            $table->string('name');
        });

        // Seed a default agent (plain-text password matches original behaviour)
        DB::table('agents')->insert([
            'username' => 'agent',
            'password' => 'agent123',
            'name'     => 'NestPune Agent',
        ]);
    }

    public function down(): void
    {
        Schema::dropIfExists('agents');
    }
};
