<?php

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

class CreateLabTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('lab', function (Blueprint $table) {
            $table->id();
             $table->unsignedBigInteger('hcp_id'); 
            $table->json('reason_for_blood_work')->nullable(); // Stores array of reasons
            $table->string('other_reason')->nullable(); // Stores custom reason if "Other" is selected
            $table->json('basic_panel')->nullable(); // Stores array of selected basic panel tests
            $table->json('basic_panel_options')->nullable(); // Stores options like "CBC with Differential"
            $table->json('thyroid_tests')->nullable(); // Stores array of selected thyroid tests
            $table->json('specialty_tests')->nullable(); // Stores array of selected specialty tests
            $table->json('cardiac_tests')->nullable(); // Stores array of selected cardiac tests
            $table->json('inflammatory_tests')->nullable(); // Stores array of selected inflammatory markers
            $table->json('hormone_tests')->nullable(); // Stores array of selected hormone tests
            $table->foreign('hcp_id')->references('hcp_id')->on('hcp')->onUpdate('no action')->onDelete('no action');
            $table->timestamps();
        });
    }

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