<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('scan_activities', function (Blueprint $table) {
            $table->id();
            $table->foreignId('id_ruangan')->nullable()->constrained('rooms')->cascadeOnUpdate()->nullOnDelete();
            $table->foreignId('id_barang')->nullable()->constrained('inventory_items')->cascadeOnUpdate()->nullOnDelete();
            $table->string('nama_petugas')->default('Petugas Mobile');
            $table->string('aktivitas', 40)->default('scan');
            $table->string('deskripsi');
            $table->timestamp('dipindai_pada')->useCurrent();
            $table->timestamp('dibuat_pada')->nullable();
            $table->timestamp('diperbarui_pada')->nullable();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('scan_activities');
    }
};
