<?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('critical_value_samples', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('periksa_id')->unique();
            $table->string('nofoto', 50)->nullable();
            $table->string('noregister', 150)->nullable();
            $table->string('nmpasien', 200)->nullable();
            $table->string('nm_spesimen', 255)->nullable();
            $table->timestamp('critical_set_at')->nullable();
            $table->unsignedBigInteger('critical_set_by_user_id')->nullable();
            $table->string('critical_set_by_name', 150)->nullable();
            $table->timestamp('followed_up_at')->nullable();
            $table->unsignedBigInteger('followed_up_by_user_id')->nullable();
            $table->string('followed_up_by_name', 150)->nullable();
            $table->timestamps();

            $table->index('nofoto');
            $table->index('critical_set_at');
            $table->index('followed_up_at');
        });
    }

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